As a critical aspect of corporate financing strategies, high-quality trade credit has been acknowledged as a favorable indicator for external stakeholders. Given the increasing prominence of sustainable development, it is worthwhile to explore whether an advanced environmental management system facilitates the attainment of financing for business operations. Therefore, to respond to this question, this study utilizes panel data spanning from 2012 to 2021, comprising Chinese listed firms in four energy and environment-related sectors, with the environmental dimension score of the CSI ESG scoring system employed for categorizing the sample into high and low environmental governance groups. The results reconcile the conflicting studies and find an inverted U-shaped effect between trade credit and corporate bank loans with lower levels of environmental governance. Within the domain characterized by higher environmental governance, the two are substituted for each other. In addition, this study introduces the Shapely decomposition method for the first time to quantify the contribution of trade credit to corporate bank loans. Drawing from these findings, we proposed practical advice to firms, financial institutions, and the government on how to choose between bank loans and trade credit against the background of sustainable development.