Abstract In water resource management, accurate water demand prediction is essential for developing effective water supply strategies and optimizing resource allocation. This study aims to investigate machine learning algorithms, particularly echo state network (ESN) models, to improve the accuracy and efficiency of water demand prediction. ESN models are selected for their excellent nonlinear time series processing capabilities, which address the challenges of traditional prediction methods when dealing with complex water resource systems. By optimizing the parameters of the ESN model, the study hopes to provide a more scientific and efficient method for residential domestic and agricultural water demand forecasting, thus supporting more refined water resources planning and management decisions. Residential water demand prediction and crop water demand prediction are the two parts of this study. In the prediction of residential water demand, based on the actual data of City Z, the optimized ESN model predicts the water demand in 2025, and the total water demand in the baseline scenario is 790.9 million m3, and the expected values of water demand in different scenarios combined with the economic growth rate and the change of water price range from 659.4708 million m3 to 730.448 million m3. The article’s accuracy analysis of crop water demand prediction indicates that the model’s relative errors in predicting the water demand of the three major crops are limited to 10%. The ESN model optimized using the machine learning algorithm in this paper has good potential for water demand prediction and is an efficient and accurate prediction tool for managing water resources.