BackgroundThe pathogens causing unexplained pneumonia in both HIV-infected or HIV-unfected patients are likely to be complex. This retrospective study aimed to characterize the etiology of pneumonia in HIV-infected and HIV-uninfected patients using bronchoalveolar lavage fluid (BALF) analysis with metagenomic next-generation sequencing (mNGS) and X-pert MTB/RIF. MethodsBetween January 2022 and May2024, 141 HIV-infected and 104 HIV-uninfected patients admitted to Nanjing Second Hospital with pneumonia were included. BALF samples were collected and analyzed using mNGS to detect bacteria, fungi, viruses, tuberculosis (TB) and non-tuberculous mycobacteria (NTM), and X-pert for TB detection. Clinical data including CD4 T-cell counts, comorbidities, and ART status were collected and analyzed. ResultsHIV-uninfected patients were found to be older and exhibited a higher prevalence of comorbidities compared to HIV-infected patients. Despite higher median CD4 T-cell counts in HIV-uninfected individuals (412 cells/μL vs. 31 cells/μL in HIV-infected), TB detection rates using X-pert and mNGS were lower than anticipated, particularly in HIV-infected patients. Mixed-pathogen infections were significantly more prevalent in HIV-infected patients, especially those with lower CD4 T-cell counts. ART use showed variable impacts on pathogen diversity, with longer treatment durations associated with reduced infection complexity but persistent immunodeficiency in some cases.In patients with pneumonia, whether HIV-infected or HIV-uninfected, pathogens often exhibit complexity, underscoring the critical role of timely mNGS and X-pert analysis of BALF for early pathogen detection.