Heart failure (HF) and osteoarthritis (OA) are medical conditions that can significantly impact daily activities. Evidence has shown that HF and OA may share some pathogenic mechanisms. However, the underlying genomic mechanisms remain unclear. This study aimed to explore the underlying molecular mechanism and identify diagnostic biomarkers for HF and OA. With the cutoff criteria of fold change (FC) > 1.3 andP< .05, 920, 1500, 2195, and 2164 differentially expressed genes (DEGs) were identified in GSE57338, GSE116250, GSE114007, and GSE169077, respectively. After making the intersection of DEGs, we obtained 90 upregulated DEGs and 51 downregulated DEGs in HF datasets and 115 upregulated DEGs and 75 downregulated DEGs in OA datasets. Afterward, we conducted genome ontology (GO) and Kyoto Encyclopedia of Genes and Genomes (KEGG) analyses, protein-protein interaction (PPI) networks, and hub genes screening based on DEGs. Then, 4 common DEGs (fibroblast activation protein alpha [FAP], secreted frizzled-related protein 4 (SFRP4), Thy-1 cell surface antigen (THY1), matrix remodeling associated 5 [MXRA5]) between HF and OA were screened and validated in GSE5406 and GSE113825 datasets, based on which we established the support vector machine (SVM) models. The combined area under the receiver operating characteristic curve (AUC) of THY1, FAP, SFRP4, and MXRA5 in the HF training and test sets reached 0.949 and 0.928. While in the OA training set and test set, the combined AUC of THY1, FAP, SFRP4, and MXRA5 reached 1 and 1, respectively. The analysis of immune cells in HF revealed high levels of dendritic cell (DC), B cells, natural killer T cell (NKT), Type 1 regulatory T cell (Tr1), cytotoxic T cell (Tc), exhausted T cell (Tex), and mucosal-associated invariant T cell (MAIT), while displaying lower levels of monocytes, macrophages, NK, CD4 + T, gamma delta T (γδ T), T helper type 1 (Th1), T helper type 2 (Th2), and effector memory T cell (Tem). Moreover, the 4 common DEGs were positively correlated with DCs and B cells and negatively correlated with γδ T. In OA patients, the abundance of monocyte, macrophage, CD4 + naïve, and natural T regulatory cell (nTreg) was higher, while the infiltration of CD8 + T, γδ T, CD8 + naïve, and MAIT was lower. The expression of THY1 and FAP was significantly correlated with macrophage, CD8 + T, nTreg, and CD8 + naïve. SFRP4 was correlated with monocyte, CD8 + T, γδ T, CD4 + naïve, nTreg, CD8 + naïve and MAIT. MXRA5 was correlated with macrophage, CD8 + T, nTreg and CD8 + naïve. FAP, THY1, MXRA5, and SFRP4 may be diagnostic biomarkers for both HF and OA, and their correlation with immune cell infiltrations suggests shared immune pathogenesis.