Intervertebral disc (IVD) degeneration and its inflammatory microenvironment ultimately led to discogenic pain, which is thought to originate in the nucleus pulposus (NP). In this study, key genes involved in NP tissue immune infiltration in lumbar disc herniation (LDH) were identified by bioinformatic analysis. Gene expression profiles were downloaded from the Gene Expression Omnibus (GEO) database. The CIBERSORT algorithm was used to analyze the immune infiltration into NP tissue between the LDH and control groups. Hub genes were identified by the WGCNA R package in Bioconductor and single-cell sequencing data was analyzed using R packages. Gene expression levels were evaluated by quantitative real-time polymerase chain reaction. The immune infiltration profiles varied significantly between the LDH and control groups. Compared with control tissue, LDH tissue contained a higher proportion of regulatory T cells and macrophages, which are associated with the macrophage polarization process. The most significant module contained three hub genes and four subclusters of NP cells. Functional analysis of these genes was performed, the hub gene expression pattern was confirmed by PCR, and clinical features of the patients were investigated. Finally, we identified TGF-β and MAPK signaling pathways as crucial in this process and these pathways may provide diagnostic markers for LDH. We hypothesize that the hub genes expressed in the specific NP subclusters, along with the infiltrating macrophages play important roles in the pathogenesis of IVD degeneration and ultimately, disc herniation.