Exercise training has been reported to alleviate cardiac fibrosis and ameliorate heart dysfunction after myocardial infarction (MI), but the molecular mechanism is still not fully clarified. Fibroblast growth factor 21 (FGF21) exerts a protective effect on the infarcted heart. This study investigates whether exercise training could increase FGF21 protein expression and regulate the transforming growth factor-β1 (TGF-β1)-Smad2/3-MMP2/9 signaling pathway to alleviate cardiac fibrosis following MI. Male wild type (WT) C57BL/6J mice and Fgf21 knockout (Fgf21 KO) mice were used to establish the MI model and subjected to five weeks of different types of exercise training. Both aerobic exercise training (AET) and resistance exercise training (RET) significantly alleviated cardiac dysfunction and fibrosis, up-regulated FGF21 protein expression, inhibited the activation of TGF-β1-Smad2/3-MMP2/9 signaling pathway and collagen production, and meanwhile, enhanced antioxidant capacity and reduced cell apoptosis in the infarcted heart. In contrast, knockout of Fgf21 weakened the cardioprotective effects of AET after MI. In vitro, cardiac fibroblasts (CFs) were isolated from neonatal mice hearts and treated with H2O2 (100 μM, 6 h). Recombinant human FGF21 (rhFGF21, 100 ng/mL, 15 h) and/or 5-Aminoimidazole-4-carboxamide ribonucleotide (AICAR, 1 mM, 15 h) inhibited H2O2-induced activation of the TGF-β1-Smad2/3-MMP2/9 signaling pathway, promoted CFs apoptosis and reduced collagen production. In conclusion, exercise training increases FGF21 protein expression, inactivates the TGF-β1-Smad2/3-MMP2/9 signaling pathway, alleviates cardiac fibrosis, oxidative stress, and cell apoptosis, and finally improves cardiac function in mice with MI. FGF21 plays an important role in the anti-fibrosis effect of exercise training.