Rapid urbanization and increasing energy consumption have intensified the need for intelligent approaches that support sustainable and efficient energy management in smart green cities. This study investigates the effectiveness of machine learning models in improving energy demand forecasting and energy optimization through a reliability-oriented evaluation framework. The research utilizes a real-world smart city energy consumption dataset comprising 17,520 hourly observations collected between January 2022 and December 2023. Three machine learning models, namely Random Forest, Support Vector Machine (SVM), and Long Short-Term Memory (LSTM), were developed and evaluated using 30 independent execution runs. Model performance was assessed through Mean Absolute Error (MAE), Root Mean Square Error (RMSE), coefficient of determination (R2), reliability analysis, and interpretability consistency measurements. The results demonstrate that LSTM achieved the best predictive performance with an MAE of 0.31, RMSE of 0.45, and R2 of 0.93, outperforming Random Forest and SVM across all evaluation metrics. Furthermore, LSTM exhibited the highest reliability score of 0.912 and superior explanation stability, indicating robust and consistent performance under repeated executions. The forecasting outputs were integrated into an energy optimization framework, resulting in reductions in peak energy loads and overall electricity consumption. These findings confirm that reliable and explainable machine learning models can support adaptive, data-driven energy management strategies capable of enhancing operational efficiency and sustainability in urban environments. The proposed framework contributes to the development of trustworthy intelligent systems for smart green cities and supports the achievement of sustainable development objectives related to clean energy, sustainable communities, and climate action.