Tetramethylpyrazine (TMP) belongs to the active ingredients of the traditional Chinese medicine Chuanxiong, which has a certain protective effect in myocardial ischemia–reperfusion (I/R) injury. It can improve postoperative cardiac function and alleviate ventricular remodeling in acute myocardial infarction patients. However, its specific protective mechanism is still unclear. In this study, a certain concentration of TMP was introduced into I/R mice or H9C2 cells after oxygen-glucose deprivation/reoxygenation (OGD/R) treatment to observe the effects of TMP on cardiomyocyte activity, cytotoxicity, apoptosis, autophagy, pyroptosis, and NLRP3 inflammasome activation. The results displayed that TMP intervention could reduce OGD/R and I/R-induced cardiomyocyte apoptosis, accelerate cellular activity and autophagy levels, and ameliorate myocardial tissue necrosis in I/R mice in a dose-dependent manner. Further, TMP prevented the formation of NLRP3 inflammasomes to suppress pyroptosis by increasing the level of cardiomyocyte autophagy after I/R and OGD/R modelling, the introduction of chloroquine to suppress autophagic activity in vivo and in vitro was further analyzed to confirm whether TMP inhibits NLRP3 inflammasome activation and pyroptosis by increasing autophagy, and we found the inhibitory effect of TMP on NLRP3 inflammasomes and its protective effect against myocardial injury were blocked when autophagy was inhibited with chloroquine. In conclusion, this experiment demonstrated that TMP unusually attenuated I/R injury in mice, and this protective effect was achieved by inhibiting the activation of NLRP3 inflammasomes through enhancing autophagic activity.