ESG performance measures the long-term sustainability of a company's development, whereas managerial short-termism cause companies to overly prioritize short-term profits at the expense of neglecting sustainable development. This study on Chinese listed companies from 2009 to 2021 examines the impact of managerial short-termism on corporate ESG performance. We found that managerial short-termism significantly inhibits corporate ESG performance. Furthermore, using text mining of internal and external sentiment data, our findings suggest that companies exhibiting negative sentiment in their annual reports and financial news reports are more susceptible to the detrimental impact of managerial short-termism on corporate ESG performance. In addition, the mechanism analyzes show that managerial short-termism affects corporate ESG performance by lowering R&D investment, reducing the internal ESG attention, declining investor sentiment and increasing financing constraints. The research results revealed that companies managing for the future can better reduce their risk in long-term development.