Although the main reason governments offer subsidies is to guide production activities and enhance the competencies of individual firms, its economic effectiveness and influential mechanism remain unclear. In this study, based on dynamic capability perspective, we introduce knowledge flows (i.e. inflows and outflows) and examine their mediation roles in the relationship between government subsidies and total factor productivity (TFP) growth. Empirical analysis is conducted using panel data from 4,335 Chinese public listed firms during the period from 2007 to 2020. The regression results show that government subsidies have a positive influence on firms’ TFP growth. Further analysis confirms that government subsidies can positively affect TFP growth by influencing both knowledge inflows and outflows. This paper enriches the current literature by involving dynamic capability theory, providing novel insights into the influential mechanisms of government subsidies. Additionally, we introduce TFP as a more comprehensive measurement to avoid bias resulting from a one-sided assessment of performance. This study also provides practical inspiration for firms to design appropriate knowledge management systems and leverage the effectiveness of government subsidies in terms of firm growth.