The relationships between environment, social, and governance (ESG) scores and debt structure are examined using the two-stage least square model with annual data from Chinese listed firms over the 2011–2020 period. The research results suggest that the ESG composite scores and long-term debt have a U curve based nonlinear relationship. The results are robust to endogeneity concerns, alternative regression model specifications, alternative ESG scores, and after controlling for additional variables. In addition, the relationship between debt maturity and S scores (but not the E and G scores) is significant in the nonlinear model. Second, the effect of ESG on long-term debt is stronger for firms within polluting industries when compared to firms in less polluting industries. Third, the effect of ESG on long-term debt is stronger when economic policy uncertainty is low. Fourth, dynamic effect investigations show that ESG activities generate long-term effects on debt maturity. Finally, an inverse U curve relationship between ESG scores and cost of debt is documented. All these results are consistent with the well-established trade-off theory. Policy wise, firms should pay attention to the S dimension when considering debt structure, and to the economic policy environment when considering the impact of ESG activities on debt structure. Academic research can focus on verifying whether these results are generalizable across countries and the stage of economic development of markets investigated.