The relationship between rheumatoid arthritis (RA) and diffuse large B-cell lymphoma (DLBCL) is well characterized, but the molecular mechanisms underlying this association have not been clearly investigated. Our study aimed to identify shared gene signatures and molecular mechanisms between RA and DLBCL. We selected multiple Gene Expression Omnibus (GEO) datasets (GSE93272, GSE83632, GSE12453, GSE1919) to obtain gene expression levels and clinical information about patients with RA and DLBCL. Weighted gene co-expression network analysis (WGCNA) was used to research co-expression networks associated with RA and DLBCL. Subsequently, we performed enrichment analysis of shared genes and screened the most significant core genes. We observed expression of the screened target gene, galectin 2 (LGALS2), in DLBCL patients and its impact on patient prognosis. Finally, we analyzed the molecular functional mechanism of LGALS2 and observed its relationship with the immune response in DLBCL using single-sample Gene Set Enrichment Analysis (ssGSEA). WGCNA recognized two major modules for RA and DLBCL, respectively. Shared genes (551) were identified for RA and DLBCL by observing the intersection. In addition, a critical shared gene, LGALS2, was acquired in the validation tests. Next, we found that the expression level of LGALS2 gradually decreased with tumor progression in DLBCL and that increased expression of LGALS2 predicted a better prognosis for DLBCL patients. ssGSEA revealed that LGALS2 is involved in immune-related pathways and has a significant regulatory effect on human immune responses. Additionally, we observed that LGALS2 is closely related to the sensitivity of multiple chemotherapeutic drugs. There is extremely little research on the molecular mechanism of correlation between RA and DLBCL. Our study identified that LGALS2 is a potential therapeutic target and an immune-related biomarker for patients with RA and DLBCL.