A corrosion prediction model was established based on the genetic algorithm (GA) and back propagation (BP) neural network to predict the long-term corrosion changes of oil well cement, Considering that the cement sheath is susceptible to corrosion and its corrosion degree is not easy to observe in acid gas wells and geological storage wells containing carbon dioxide (CO2). The initial weights and thresholds of the neural network were optimized by GA. The number of hidden layer nodes was selected by error verification, and the network was trained with an improved algorithm. The sample data was regression processed based on the empirical formula and was used in the network training. The simulation results shows that: The improved GA-BP network model (3–5-6–1) has a higher prediction accuracy with faster convergence and better fitting effect compared with the traditional BP neural network and the regression model (REG) in long-term prediction of corrosion depth in oil well cement. The regression coefficient (R2) of the prediction model is 0.9913, and the mean square error (MSE) of test samples is 0.0026. The modeling idea proposed in this paper can be applied to improve the accuracy of prediction models in predicting the corrosion of oil well cement.