Green finance, as a crucial policy instrument for achieving environmental and social objectives, has gradually become a focal point of reform in many countries. This study employs the comprehensive ESG (Environmental, Social, and Governance) score of enterprises as a proxy variable for environmental and social responsibility, utilizes difference-in-difference (DID) method and micro-level data from Chinese listed companies spanning the period from 2011 to 2021, reveals that green credit policy significantly enhances the environmental and social performance of relevant enterprises. Further research indicates that green credit policy, through optimizing the allocation of credit resources, fostering environmental awareness among management, and increasing investment in research and development, contribute to the improvement of enterprise ESG performance. Additionally, the degree of regional marketization and the level of financial constraints on enterprises act as moderating factors in the policy's effectiveness, with the enhancing effect of the policy being more pronounced for enterprises with initially top and bottom ESG performance.