This paper provides a comprehensive review of the integration of artificial intelligence (AI) within the context of Industry 4.0, emphasizing its transformative impact on various industries and its specific applications in energy consumption forecasting for sustainable energy management. Beginning with a historical perspective on industrial evolution, from automation to the current cyber-physical systems era, the review highlights the pivotal role of AI in reshaping manufacturing processes. The article explores the diverse applications of AI in the energy sector, particularly its effectiveness in short-term load forecasting, demand response optimization, and accurate predictions for renewable energy sources like solar and wind. The growing complexity of power systems due to decentralization and the proliferation of grid-connected devices is discussed, underscoring the importance of effective information exchange facilitated by AI. Additionally, the review delves into various models used for energy forecasting, including supervised learning models, artificial neural networks, and deep learning models. The practical applications of AI in power system control, management, energy market pricing, and policy recommendations are outlined, showcasing its potential in optimizing energy efficiency and balancing electricity production and consumption. The practical examples of AI's role in improving predictions of supply and demand, such as Google's subsidiary DeepMind enhancing wind power output forecasts, highlight the real-world impact of these technologies. However, the abstract also acknowledges existing challenges, including insufficient theoretical background, practical expertise, and financial constraints hindering widespread AI adoption in the energy industry. In conclusion, the article offers valuable insights into the current state, challenges, and potential of AI in forecasting energy consumption, providing a roadmap for sustainable energy management across diverse industries.