Background Chronic obstructive pulmonary disease (COPD) is often accompanied by pulmonary infection, inflammatory responses, decreased immunity, and decreased lung function. The relationships among the pulmonary inflammation index (PII), lung function, and immunity in COPD patients with pulmonary infection remain unclear. Methods This retrospective observational study enrolled 234 participants (patients with COPD and pulmonary infection, patients with COPD without pulmonary infection, and healthy individuals) from January 2017 to December 2019. Results Levels of interleukin (IL)-6 were lower and levels of IL-8 were higher in patients with COPD and pulmonary infection. Levels of white blood cells (WBCs), C-reactive protein (CRP), IL-6, IL-8, tumor necrosis factor (TNF)-α and CD8+ cells were higher, while levels of CD3+ and CD4+ cells, the CD4+/CD8+ ratio, forced expiratory volume in 1 s (FEV1), FEV1 % predicted (FEV1%pred), and FEV1/forced vital capacity (FVC) (FEV1%FVC) were lower in patients with COPD and pulmonary infection. Levels of WBCs, CRP, IL-6, IL-8, and TNF-α were negatively associated with FEV1, FEV1%pred and FEV1%FVC. Conclusions Patients with COPD and pulmonary infection have high PIIs, decreased immunity, and poor lung function. PII is closely related to lung function and may represent a useful biomarker for the assessment of patients with COPD and pulmonary infection.