The gut microbiota plays a significant role in tumor pathogenesis by regulating the host metabolism and immune response, and there are few studies focused on tracking changes in the gut microbiota from the onset of lung cancer. Therefore, the aim of our study is combining preclinical and clinical research to thoroughly analyze the signatures of fecal microbiota in lung cancer, which will be useful for early diagnosis and predicting the therapeutic efficacy of lung cancer. The first part of this study analyzed the fecal metagenomic differences between patients with non-small cell lung cancer and healthy subjects, and the second part of this work constructed a murine lung cancer model to monitor changes in mouse fecal metagenomics and T cell immunology during lung cancer progression. We found that the fecal microbiota was altered in both humans and mice with lung cancer, characterized by a significantly reduced microbial diversity and number of beneficial microbes, with increases in potential pathogens. The fecal level of Akkermansia muciniphila and the gut metabolic module of the secondary bile acid metabolism were diminished in both humans and mice with lung cancer compared with healthy subjects. Splenomegaly was observed in the lung cancer mice. Flow cytometer analysis of the splenocytes revealed substantial alterations in the proportions of T cell subsets in the lung cancer mice, characterized by significant increases in CD4+Foxp3+CD25+ T regulatory cells (p < 0.05) while significant decreases in CD3+ T cells (p < 0.001), CD4+ T cells (p < 0.001), and the CD4+/CD8+ ratio (p < 0.01). Vertical and longitudinal analyses of the fecal microbiota of the two mouse groups identified some lung cancer biomarkers (including Acutalibacter timonensis, Lachnospiraceae bacterium NSJ-38 sp014337195, etc.). The fecal microbiota of the lung cancer mice had a reduced metagenomic potential for neurotransmitters (melatonin, γ-aminobutyric acid, and histamine) compared with healthy mice. In summary, this study found that the diversity, structure, and composition of gut microbiota vary between cancer and healthy conditions, ultimately leading to changes in the potential for functional metagenomics.