This study examines the relationship between Chinese firms’ corporate social responsibility (CSR) and their earnings management (EM) practices. As China rapidly emerges as one of the largest exporters as well as importers, an understanding of Chinese CSR practices is increasingly important not only to Chinese authorities and firms, but also to international stakeholders. However, Chinese CSR has been largely underestimated in previous studies, and this CSR–EM relationship has never been sufficiently examined with regard to Chinese firms. In addition, this study measures the level of EM using two different methods: accrual‐based EM (AEM) and real activity‐based EM (REM). In general, REM is regarded as more costly but less detectable, while AEM is regarded as less costly but more detectable, owing to the fact that AEM is subject to greater scrutiny from auditors and regulators. The results show that Chinese firms’ enhanced CSR generally decreases their EM practices. On the contrary, state‐controlled firms and firms operating in more institutionally developed regions are more likely to engage in REM, while increasing their CSR activities. These findings provide new evidence that managers in Chinese firms tend to opportunistically adopt CSR practices according to the firm's institutional environment.