It examines how data analytics improves energy efficiency in large-scale distributed systems via code reworking. The primary goal is to study how data-driven techniques maximize resource allocation, energy usage, and system performance. Secondary data-based reviews of energy-efficient data analytics case studies from Google, Facebook, AWS, and Microsoft are used in the process. Significant results show that performance profiling, real-time monitoring, predictive modeling, and energy-aware resource management reduce energy use and ensure system scalability and performance. Energy savings were realized utilizing dynamic resource allocation, job scheduling, load balancing, and predictive analytics using machine learning. Energy consumption is also reduced by managing network traffic and data storage. However, integrating contemporary analytics tools into older systems and handling their massive data sets remain substantial obstacles. The paper recommends uniform legislation to promote energy-efficient practices, incentives for sustainable computing research, and industry best practices. This work emphasizes energy efficiency in large-scale distributed systems and advances sustainable computing research.