Predicting ship trajectories plays a vital role in ensuring navigational safety, preventing collision incidents, and enhancing vessel management efficiency. The integration of advanced machine learning technology for precise trajectory prediction is emerging as a new trend in sophisticated geospatial applications. However, the complexity of the marine environment and data quality issues pose significant challenges to accurate ship trajectory forecasting. This study introduces an innovative trajectory prediction method, combining data encoding representation, attribute correlation attention module, and long short-term memory network. Initially, we process AIS data using data encoding conversion technology to improve representation efficiency and reduce complexity. This encoding not only preserves key information from the original data but also provides a more efficient input format for deep learning models. Subsequently, we incorporate the attribute correlation attention module, utilizing a multi-head attention mechanism to capture complex relationships between dynamic ship attributes, such as speed and direction, thereby enhancing the model’s understanding of implicit time series patterns in the data. Finally, leveraging the long short-term memory network’s capability for processing time series data, our approach effectively predicts future ship trajectories. In our experiments, we trained and tested our model using a historical AIS dataset. The results demonstrate that our model surpasses other classic intelligent models and advanced models with attention mechanisms in terms of trajectory prediction accuracy and stability.