This study extends the existing research on carbon trading policies from the perspective of mediating effects. Based on the difference-in-differences method, this study helps to understand the relationship between China’s carbon trading policies and resource allocation efficiency. The study finds that carbon trading policy promotes the optimization of capital allocation efficiency but does not promote the optimization of labor allocation efficiency. This conclusion has passed a series of robustness tests. Moreover, our analysis shows that carbon trading policies can influence resource allocation efficiency through per capita GDP, foreign direct investment, and innovation levels using multiple mediating models. Factors such as market size, the number of emission entities, and the behavior of market participants affect the resource allocation efficiency in the carbon trading process. Finally, the spatial spillover effect of the carbon trading policy is verified. This paper provides empirical evidence and policy implications for achieving the dual carbon goal and sustainable development.