Energy consumption optimization in student dormitories requires accurate prediction and strategic intervention strategies. This study presents a comprehensive prediction and optimization system for energy usage at Ki Hajar Dewantara Student Dormitory, Indonesia Defense University, utilizing Extreme Gradient Boosting (XGBoost) algorithm integrated with temporal operational scheduling features a novel approach for institutional dormitory energy forecasting. The system analyzes over 3,900 electrical devices across three dormitory buildings, incorporating temporal features and operational schedules to predict hourly energy consumption. The XGBoost model demonstrates excellent prediction performance with R² = 0.9482 and MAPE = 10.24%, significantly exceeding established benchmarks for building energy forecasting. Feature importance analysis reveals working hours as the dominant factor (>85%) influencing consumption patterns, followed by occupancy rate and temperature. The analysis identifies air conditioning systems as the primary energy consumer, accounting for over 80% of total consumption. The optimization framework identifies potential energy savings of approximately 28% through strategic device replacement and schedule modifications, translating to annual cost savings of over Rp 600 million with economically viable return on investment periods. This machine learning-based approach demonstrates practical applicability for student dormitory energy management and provides a replicable methodology adaptable to diverse residential institutional buildings in tropical climates.