In the present study, the Gene Expression Omnibus (GEO) dataset combined with machine learning was used to study differential genes in acute myocardial infarction (AMI) and to predict potential components and herbal medicines with regulatory effects. The human genome datasets of AMI (GSE66360 and GSE61145) were downloaded from the GEO database, and GSE66360 was used as the test set. After correction by normalization Between Arrays package of R, the limma package was used to obtain differentially expressed genes (DEGs). Then, we carried out Gene Ontology (GO), Kyoto Encyclopedia of Genes and Genomes (KEGG), and Disease Ontology (DO) enrichment analysis of DEGs. The feature genes were screened by SVM and random forest tree method, and the obtained feature genes were verified by the GSE61145 dataset. The components of traditional Chinese medicine (TCM) corresponding to AMI feature genes were found by the CTD database, and the corresponding TCM components were mapped by the Coremine database. According to the Dictionary of Traditional Chinese Medicine, Chinese Materia Medica, and Chinese Pharmacopoeia, the frequency, the four qi, five flavors, and meridian tropism of the obtained TCM were summarized. Through the analysis of the GSE66360 dataset, 317 DEGs were obtained, of which 306 were up-regulated, and 11 were down-regulated. GO and KEGG enrichment analyses showed that the DEGs of AMI were mainly involved in neutrophil-mediated inflammation and immune response, abnormal lipid metabolism, lipid, and atherosclerosis-related pathways. DO enrichment analysis showed that the DEGs were closely related to atherosclerotic cardiovascular diseases and lung diseases. Six feature genes were obtained by SVM and random forest tree method, including ZFP36, GADD45A, PELI1, METRNL, MMP9, and CXCL16. Moreover, we found that the treatment of AMI Chinese medicine to sweet, bitter, and warm mostly attributed to the spleen, stomach, and liver. Besides, the components corresponding to the feature genes regulating AMI (ZFP36, GADD45A, PELI1, METRNL, MMP9, CXCL16) mainly included benzo(a)pyrene, tetrachlorodibenzodioxin, acetaminophen, and so on, and the corresponding TCMs included Camellia sinensis, Curcumaaromatica Salisb, Panax ginseng, and so on. In addition, a sweet taste, bitter taste, warm taste, and channel entry mainly belonged to the spleen, stomach, and liver meridians.