Background: Gynecomastia, caused by an estrogen–testosterone imbalance, affects males across various age groups. With unclear mechanisms and no approved drugs, the condition underscores the need for efficient, innovative treatment strategies. Methods: This study utilized deep learning-based computational methods to discover potential drug compounds for gynecomastia. To identify genes and pathways associated with gynecomastia, initial analyses included text mining, biological process exploration, pathway enrichment and protein–protein interaction (PPI) network construction. Subsequently, drug–target interactions (DTIs) were examined to identify potential therapeutic compounds. The DeepPurpose toolkit was employed to predict interactions between these candidate drugs and gene targets, prioritizing compounds based on their predicted binding affinities. Results: Text mining identified 177 genes associated with gynecomastia. Gene Ontology (GO) biological process and Kyoto Encyclopedia of Genes and Genomes (KEGG) pathway analyses identified critical genes and pathways, with notable involvement in signal transduction, cell proliferation and steroid hormone biosynthesis. PPI network analysis highlighted 10 crucial genes, such as IGF1, TGFB1 and AR. DTI analysis and DeepPurpose predictions identified 12 potential drugs, including conteltinib, yifenidone and vosilasarm, with high predicted binding affinities to the target genes. Conclusions: The study successfully identified potential drug compounds for gynecomastia using a deep learning-based approach. The findings highlight the effectiveness of combining text mining and artificial intelligence in drug discovery. This innovative method provides a new avenue for developing specific treatments for gynecomastia and underscores the need for further experimental validation and optimization of prediction models to support novel drug development.