Two-dimensional galvanometer scanners are critical instruments in optical scanning systems. However, the scanning trajectories of galvanometer scanners are susceptible to distortions caused by mechanical and electrical imperfections, which inevitably compromise optical scanning performance. While closed-loop feedback signals can help mitigate these distortions, their accuracy is often restricted by perturbation during prolonged high-speed operation. In this study, we propose a deep learning-based trajectory correction method to achieve high-performance optical scanning in galvanometer scanners. By integrating a Convolutional Neural Network (CNN) with a Long Short-Term Memory (LSTM), the hybrid architecture effectively reduced trajectory errors by over 97% across three driving configurations. Furthermore, the optical performance was assessed by imaging three different patterns using the corrected trajectories, revealing a substantial improvement in image quality compared to those reconstructed from the original uncorrected trajectories.