Lung cancer, a leading cause of cancer-related deaths worldwide, presents a complex challenge due to its high incidence and mortality rates. While immunotherapy has emerged as a promising treatment option, it also carries the risk of immune-related adverse events, particularly severe infections. This study aims to explore the value of second-generation gene sequencing, specifically metagenomic next-generation sequencing (mNGS), in lung cancer immunotherapy patients with concurrent infections. By analyzing clinical data and pathogen distribution, we can better understand the impact of immunotherapy on infection patterns and guide treatment decisions. The study included 107 lung cancer patients with infections, divided into immunotherapy and non-immunotherapy groups. Results showed increased bacterial and fungal infections post-immunotherapy, with higher detection rates of Mycobacterium tuberculosis, Pneumocystis jirovecii, and Aspergillus fumigatus in the immunotherapy group. The non-immunotherapy group had a higher rate of mixed bacterial infections. mNGS demonstrated good applicability and significantly impacted treatment outcomes. The study highlights the importance of monitoring inflammatory markers and using mNGS for early and precise anti-infective treatment. It also emphasizes the need for focused monitoring of high-risk patients and timely prophylactic treatment to reduce infection incidence and improve prognosis. The findings provide valuable insights into the complex relationship between immunotherapy and infections, offering a more comprehensive understanding of lung cancer treatment and management.