COVID-19, a serious respiratory disease that has the potential to affect numerous organs, is a serious threat to the health of people around the world. The objective of this article is to investigate the potential biological targets and mechanisms by which SARS-CoV-2 affects benign prostatic hyperplasia (BPH) and related symptoms. We downloaded the COVID-19 datasets (GSE157103 and GSE166253) and the BPH datasets (GSE7307 and GSE132714) from the Gene Expression Omnibus (GEO) database. In GSE157103 and GSE7307, differentially expressed genes (DEGs) were found using the "Limma" package, and the intersection was utilized to obtain common DEGs. Further analyses followed, including those using Protein-Protein Interaction (PPI), Gene Ontology (GO) function enrichment analysis, and the Kyoto Encyclopedia of Genes and Genomes (KEGG). Potential hub genes were screened using three machine learning methods, and they were later verified using GSE132714 and GSE166253. The CIBERSORT analysis and the identification of transcription factors, miRNAs, and drugs as candidates were among the subsequent analyses. We identified 97 common DEGs from GSE157103 and GSE7307. According to the GO and KEGG analyses, the primary gene enrichment pathways were immune-related pathways. Machine learning methods were used to identify five hub genes (BIRC5, DNAJC4, DTL, LILRB2, and NDC80). They had good diagnostic properties in the training sets and were validated in the validation sets. According to CIBERSORT analysis, hub genes were closely related to CD4 memory activated of T cells, T cells regulatory and NK cells activated. The top 10 drug candidates (lucanthone, phytoestrogens, etoposide, dasatinib, piroxicam, pyrvinium, rapamycin, niclosamide, genistein, and testosterone) will also be evaluated by the P value, which is expected to be helpful for the treatment of COVID-19-infected patients with BPH. Our findings reveal common signaling pathways, possible biological targets, and promising small molecule drugs for BPH and COVID-19. This is crucial to understand the potential common pathogenic and susceptibility pathways between them.