Asthenozoospermia (AZS) is one of the most common types of male infertility. Current evidence revealed that type 2 diabetes mellitus (T2DM) is closely associated with declining semen quality, especially for poor sperm motility. This study aimed to uncover the genetic interrelationships and important biomarkers between AZS and T2DM. Transcriptome data regarding AZS and T2DM were downloaded from the Gene Expression Omnibus (GEO) database. We performed GO and pathway analysis, and protein-protein interaction (PPI) network construction for T2DM-related differentially expressed genes (DMRGs). Moreover, we calculated receiver operator characteristic (ROC) curve and conducted external independent validation. Expression of hub DMRGs was assessed for patients using the qPCR method. MiRNA interaction and immune infiltration were subsequently characterized. A total of 554 overlapping DMRGs were identified between the AZS/T2DM and healthy groups. These overlapping DMRG participated in the DNA damage-, energy metabolism-, and immune-related biological pathways. Module function analysis discovered that the top three PPI modules were tightly correlated with DNA damage-related processes. After external validation in other independent datasets, two hub DMRGs (TBC1D12 and SCG5) were obtained. ROC analysis revealed that TBC1D12 and SCG5 had good diagnostic performance (area under the curve > 0.75). Immune infiltration profile showed that the level of T cell co-stimulation and CD8+_T_cells were negatively related to the hub DMRGs expression. Mirna interaction analysis showed 15 significant hub DMRGs-miRNA interactions. The qPCR results showed that expression of TBC1D12 and SCG5 were significantly different between sperm samples from diabetic patients with AZS and controls. The present study revealed molecular signatures and critical pathways between the AZS and T2DM, and identified two hub DMRGs of TBC1D12 and SCG5. The data would provide novel understandings of shared pathogenic mechanisms in T2DM-associated AZS.