Background: Patients with anaphylaxis are at risk for ST-segment elevation myocardial infarction (STEMI). However, the pathological links between anaphylaxis and STEMI remain unclear. Here, we aimed to explore shared biological processes, immune effector cells, and hub genes of anaphylaxis and STEMI.Methods: Gene expression data for anaphylactic (GSE69063) and STEMI (GSE60993) patients with corresponding healthy controls were pooled from the Gene Expression Omnibus database. Differential expression analysis, enrichment analysis, and CIBERSORT were used to reveal transcriptomic signatures and immune infiltration profiles of anaphylaxis and STEMI, respectively. Based on common differentially expressed genes (DEGs), Gene Ontology analysis, cytoHubba algorithms, and correlation analyses were performed to identify biological processes, hub genes, and hub gene-related immune cells shared by anaphylaxis and STEMI. The robustness of hub genes was assessed in external anaphylactic (GSE47655) and STEMI (GSE61144) datasets. Furthermore, a murine model of anaphylaxis complicated STEMI was established to verify hub gene expressions. The logistic regression analysis was used to evaluate the diagnostic efficiency of hub genes.Results: 265 anaphylaxis-related DEGs were identified, which were associated with immune-inflammatory responses. 237 STEMI-related DEGs were screened, which were involved in innate immune response and myeloid leukocyte activation. M0 macrophages and dendritic cells were markedly higher in both anaphylactic and STEMI samples compared with healthy controls, while CD4+ naïve T cells and CD8+ T cells were significantly lower. Enrichment analysis of 33 common DEGs illustrated shared biological processes of anaphylaxis and STEMI, including cytokine-mediated signaling pathway, response to reactive oxygen species, and positive regulation of defense response. Six hub genes were identified, and their expression levels were positively correlated with M0 macrophage abundance and negatively correlated with CD4+ naïve T cell abundance. In external anaphylactic and STEMI samples, five hub genes (IL1R2, FOS, MMP9, DUSP1, CLEC4D) were confirmed to be markedly upregulated. Moreover, experimentally induced anaphylactic mice developed impaired heart function featuring STEMI and significantly increased expression of the five hub genes. DUSP1 and CLEC4D were screened as blood diagnostic biomarkers of anaphylaxis and STEMI based on the logistic regression analysis.Conclusion: Anaphylaxis and STEMI share the biological processes of inflammation and defense responses. Macrophages, dendritic cells, CD8+ T cells, and CD4+ naïve T cells constitute an immune cell population that acts in both anaphylaxis and STEMI. Hub genes (DUSP1 and CLEC4D) identified here provide candidate genes for diagnosis, prognosis, and therapeutic targeting of STEMI in anaphylactic patients.