Short-term load forecasting of power systems is an important part of the daily dispatch of the power sector. The accuracy of short-term load forecasting directly affects the safety, reliability and economy of power system operation. Therefore, the research on short-term load forecasting methods has always been the focus of scholars at home and abroad. In recent years, artificial neural networks have been widely studied as an intelligent algorithm and applied to the field of short-term power load forecasting. The network structure and learning law of artificial neural network are introduced. The mathematical model of short-term load forecasting based on BP neural network and Elman neural network is established respectively. Based on the basic structure of the BP neural network, a subsequent layer is added to store the internal state, so that the system can adapt to the time-varying characteristics. In the neural network modeling process, the model is optimized from the aspects of network algorithm, excitation function and network structure to improve the convergence speed and prediction accuracy of the network. In the simulation process, the above two mathematical models use the same data samples for short-term power load forecasting. In the modeling process, in order to ensure the stability of the system, a small learning rate is set, and the selection range is between 0.01-0.8. During the modeling process, the error between different learning rates is compared. Finally, the learning rate of 0.43 is selected. By comparing the prediction error with the prediction accuracy, the prediction effect of the Elman neural network model is better than that of the BP neural network model.