Background. Myocardial ischemia (MI) is a major public health problem with high mortality and morbidity worldwide. Huoxue Wentong formula (HX), a traditional Chinese medicine (TCM) formula, exhibits unambiguous effects on treating MI and preventing cardiovascular diseases. However, the molecular mechanism of the therapeutic effects of HX on MI remains largely unknown. Objective. This study combined microbiology, metabolomics, and network pharmacology to explore the relationship between the gut microbiota and its metabolites in MI rats and the efficacy of HX. Methods. First, the MI rat model was established by ligation of left anterior descending. Echocardiography, Masson’s staining, and hematoxylin and eosin staining were used to evaluate the effect of HX on MI. Then, fecal metabolomics and 16S rRNA sequencing were used to obtain the microbial and metabolic characteristics of HX on MI. After that, network pharmacology was used to predict the target and action pathway of HX in treating MI. Finally, the relationship between fecal metabolites and target was explored through bioinformatics. Results. HX can improve the cardiac function and ameliorated myocardial fibrosis in MI rats. Moreover, HX can affect the gut microbiota community and metabolites of MI rats, especially Bacteroides, Deferribacteres, Ruminococcus_sp._zagget7, Acidobacteria, daidzein, L-lactic acid, and malate. Network pharmacology found that HX can function through tumor necrosis factor (TNF), tumor protein p53 (TP53), interleukin 6 (IL6), vascular endothelial growth factor A (VEGFA), fos proto-oncogene (FOS), bcl2-associated X (BAX), myeloperoxidase (MPO), PI3K-Akt signaling pathways, and HIF-1 signaling pathway. The mechanism study showed that the anti-MI effect of HX was related to valine, leucine, and isoleucine biosynthesis, fatty acid biosynthesis, and arachidonic acid metabolism. Conclusion. This study demonstrates that HX treated MI rats in a multitarget and multipathway manner. Its mechanism is related to the change of gut microbiota and the regulation of valine, leucine and isoleucine biosynthesis, fatty acid biosynthesis, and arachidonic acid metabolism.