Amid the global pursuit of carbon neutrality, how artificial intelligence (AI) reshapes corporate environmental behavior and low-carbon transformation has attracted growing policy and academic interest. Using panel data of Chinese A-share listed firms covering 2012 to 2024, this paper adopts a moderated mediation model to systematically explore the impact of AI on corporate carbon emission performance (CEP), as well as the mediating role of ESG performance and the moderating effect of financing constraints. The empirical results show that AI significantly improves corporate carbon emission performance. ESG acts as a partial mediator: AI facilitates corporate carbon reduction by promoting firms’ comprehensive sustainable development. Financing constraints generate an asymmetric moderating effect along the mediation path. In the first stage, financing constraints weaken AI’s positive effect on ESG performance; in the second stage, they strengthen ESG’s contribution to lowering carbon emissions, forming a “restrain first, promote later” pattern. Heterogeneity tests demonstrate that this environmental effect of AI is more pronounced for state-owned enterprises, heavy-polluting firms and enterprises located in eastern China. Baseline outcomes remain valid after multiple robustness checks including core variable replacement and instrumental variable estimation. This study confirms that the environmental dividends brought by AI are highly conditional. It provides valuable implications for governments to design targeted green financial systems and support enterprises to formulate effective low-carbon transformation strategies.