BACKGROUND: Although several studies have demonstrated that preexisting diabetes mellitus (DM) may increase the risk of lung cancer (LC), rare research of the certain pathophysiology was reported up to now. METHODS: Aiming to identify the differentially expressed genes (DEGs) between type 2 diabetes mellitus (T2DM) and LC, gene expression profiles GSE55650 and GSE136043 were downloaded in the Gene Expression Omnibus (GEO) database. We carried out biological function analysis to seek significantly enriched pathways and functions for DEGs. A protein-protein interaction (PPI) network was performed to explore hub genes for diabetes and LC during Metformin's treatment. RESULTS: Finally, the study found that there were 756 genes overlapped between T2DM and LC samples. It contained 133 common genes up-regulated both in T2DM and LC (DEGs1), 275 independent genes down-regulated in LC (DEGs2), 246 common genes down-regulated in both (DEGs3), and 102 independent genes down-regulated in diabetes (DEGs4). Glycine, serine and threonine metabolism, arginine and proline metabolism, TGF-beta signaling pathway, and pathways in cancer were significantly enriched in DEGs2 and DEGs4. Four hub genes (C3, THBS1, CXCL1, and TTN) were identified after treatment of Metformin (P<0.05, T-test). CONCLUSION: Our findings demonstrated that the above-mentioned hub genes might play functional roles in the treatment of metformin for patients with diabetes and LC.