Green communications have always been a target for the information industry to alleviate energy overhead and reduce fossil fuel usage. In current 5G and future 6G era, there is no doubt that the volume of network infrastructure and the number of connected terminals will keep exponentially increasing, which results in the surging energy cost. It becomes growing important and urgent to drive the development of green communications. However, 6G will inevitably have increasingly stringent and diversified requirements for Quality of Service (QoS), security, flexibility, and even intelligence, all of which challenge the improvement of energy efficiency. Moreover, the dynamic energy harvesting process, which will be adopted widely in 6G, further complicates the power control and network management. To address these challenges and reduce human intervene, Artificial Intelligence (AI) has been widely recognized and acknowledged as the only solution. Academia and industry have conducted extensive research to alleviate energy demand, improve energy efficiency, and manage energy harvesting in various communication scenarios. In this paper, we present the main considerations for green communications and survey the related research on AI-based green communications. We focus on how AI techniques are adopted to manage the network and improve energy harvesting toward the green era. We analyze how state-of-the-art Machine Learning (ML) and Deep Learning (DL) techniques can cooperate with conventional AI methods and mathematical models to reduce the algorithm complexity and optimize the accuracy rate to accelerate the applications in 6G. Finally, we discuss the existing problems and envision the challenges for these emerging techniques in 6G.