The stability of navigation in waves is crucial for ships, and the effect of the waves on navigation stability is complicated. Hence, the LSTM neural network technique is applied to predict the course changing of a ship in different wave conditions, where K-means clustering analysis is used for the category of the ship’s navigation data to improve the quality of the database. In this paper, the effect of the initial database obtained by the K-means clustering analysis on prediction accuracy is studied first. Then, different input features are used to establish the database to train the neural network, and the influence of the database by different input features on the accuracy of the navigation prediction is discussed and analyzed. Finally, multi-task learning is used to make the neural network better predict the navigation in various wave conditions. Using the improved neural network model, the course of an autopilot ship in waves is predicted, and the results show that the current database and the neural network model are accurate enough for the course prediction of the autopilot ship in waves.