Climate risk’s effects on society and economic development are becoming more pronounced, and enterprises have to seize the opportunity for green transformation. Based on public company data from 2011 to 2022, this study explores the causal relationship between climate risk exposure (CRE) and ESG performance by using a two-way fixed effect mode. The results indicate that CRE significantly enhances firms’ ESG performance, which makes improvements in environmental practices. The impact of the promotion is particularly pronounced in state-owned and low-polluting businesses. In addition, it can improve ESG through potential impact channels, such as employing environmental executives, improving environmental protection, and boosting green innovation. Meanwhile, the digital level and financing constraints of enterprises play an effective moderating role. Further discussion shows that the increase in CRE has prompted firms to fulfill environmental responsibilities and reduce carbon emissions. This study provides new quantitative evidence on how firms respond to climate risk, expanding the existing research on ESG performance. It further examines the specific impact path of climate risk on companies’ and green transformation and provides more firm-level insights for policymakers to address climate change. These results enrich the theoretical system of climate risk management and help enterprises strengthen awareness of climate risk to cope with sustainable development.