With the increasing demand for energy in urban areas, there is a pressing need to manage energy consumption more effectively. Buildings, especially commercial and industrial ones, are major consumers of energy. Implementing AI-powered solutions can help monitor, predict, and reduce energy usage, leading to substantial cost savings and more efficient energy use. Integrating Industry 4.0 and the Internet of Things (IoT) into smart buildings presents a significant opportunity for enhancing energy management through advanced technologies. The increasing demand for energy in urban areas necessitates the development of more efficient energy management strategies, particularly within smart buildings, which are significant energy consumers. This study proposes an AI-powered deep learning framework utilizing Convolutional Neural Networks (CNNs) to enhance energy management in smart buildings, leveraging the ASHRAE - Great Energy Predictor III dataset. The proposed framework leverages deep learning techniques to analyze historical energy data, weather conditions, and building characteristics to forecast future energy usage accurately. Additionally, the framework includes anomaly detection mechanisms to identify inefficiencies and faults in the energy management system. By optimizing energy consumption in real-time and implementing demand response strategies, the framework aims to reduce energy costs and enhance the overall efficiency of smart buildings. The proposed CNN-IoT-based energy management framework in smart buildings demonstrates significant advancements over existing methods, achieving an accuracy of 88 %. These performance metrics indicate a substantial improvement in prediction accuracy and efficiency compared to existing approaches such as SVM, ELM, and LSTM.