In this study, we investigate the optimization of energy efficiency in Device-to-Device (D2D) communication systems through the implementation of a deep learning-based resource allocation algorithm. Effective energy utilization is crucial for enhancing the performance of D2D networks by reducing interference and improving the quality of service for secondary users. Our proposed algorithm leverages deep reinforcement learning to dynamically manage energy resources, thereby optimizing the allocation process in real-time. The integration of deep learning techniques allows the system to adapt to varying network conditions and user demands, resulting in significant performance improvements. Experimental results demonstrate that our approach not only extends device battery life and reduces operational costs but also enhances the overall reliability and sustainability of D2D communication networks. This research provides a comprehensive framework for achieving energy-efficient resource allocation in next-generation wireless communication systems.