Background Observational studies have shown a significant association between immune cells and heart failure (HF). Nevertheless, the precise biological mechanisms underlying this association remain unclear. Methods To investigate the causative relationships and underlying mechanisms between immune cell traits and adult HF, 3 main methods of Mendelian randomization were used: 2‐sample Mendelian randomization, multivariable Mendelian randomization with controlling for several factors affecting HF, and mediation analysis. Results from the inverse variance‐weighted model indicated that genetic predispositions for human leukocyte antigen‐type DR (HLA DR) on CD33dim HLA DR+ CD11b+ (odds ratio, 0.967 [95% CI, 0.939–0.996]; P =0.028) may be associated with a reduced risk of HF. Although the association between HF and HLA DR on CD33 dim HLA DR+ CD11b+ did not withstand multiple‐testing correction, the Mendelian randomization results ( P IVW <0.05) decrease the likelihood that the observational results are due to chance. Results Our 2‐step mediation analysis demonstrated that genetic predispositions for HLA DR on CD33dim HLA DR+ CD11b+ (odds ratio,1.085 [95% CI, 1.020–1.155]; P =0.010) was associated with increased levels of the metabolite Octadecanedioate, while genetic predispositions for Octadecanedioate levels (odds ratio, 0.917 [95% CI, 0.849–0.991]; P =0.028) was associated with a reduced risk of HF. Moreover, our results also demonstrated that the association between HLA DR on CD33dim HLA DR+ CD11b+ and HF was possibly mediated by Octadecanedioate levels, with a mediation proportion of 21.4% [95% CI, 43.7 –0.998]. Conclusions These findings underscore the importance of HLA DR on CD33dim HLA DR+ CD11b+ in the development of HF, with Octadecanedioate levels acting as a possible mediator in this pathway.