In order to address the issues of significant energy and resource waste, low-energy management efficiency, and high building-maintenance costs in hot-summer and cold-winter regions of China, a research project was conducted on an office building located in Nantong. In this study, a data-driven golden jackal optimization (GJO)-based Long Short-Term Memory (LSTM) short-term energy-consumption prediction and optimization system is proposed. The system creates an equivalent model of the office building and employs the genetic algorithm tool Wallacei to automatically optimize and control the building’s air conditioning system, thereby achieving the objective of reducing energy consumption. To validate the authenticity of the optimization scheme, unoptimized building energy consumption was predicted using a data-driven short-term energy consumption-prediction model. The actual comparison data confirmed that the reduction in energy consumption resulted from implementing the air conditioning-optimization scheme rather than external factors. The optimized building can achieve an hourly energy saving rate of 6% to 9%, with an average daily energy-saving rate reaching 8%. The entire system, therefore, enables decision-makers to swiftly assess and validate the efficacy of energy consumption-optimization programs, thereby furnishing a scientific foundation for energy management and optimization in real-world buildings.