Given the rise of morbidity and mortality caused by Klebsiella pneumoniae (KP), the increasing number of strains resistant to antibiotics, and the emergence of hypervirulent Klebsiella pneumonia, treatment of KP infection becomes difficult; thus, novel drugs are necessary for treatment. Anthocyanins, or natural flavonoids, have an extensive effect against bacterial infection. However, few studies on anti-KP are identified. Here, we evaluated the therapeutic effect of purple sweet potato anthocyanins (PSPAs) on KP, containing 98.7% delphinidin 3-sambubioside. Results showed that KP-infected mice after PSPAs treatment manifested decreased mortality, weakened lung injury, dampened inflammatory responses, and reduced bacterial systemic dissemination in vivo. In Vitro, PSPAs significantly suppressed pyroptosis and restricted NLRP3 inflammasome activation in alveolar macrophages infected with KP. As for the mechanism, PSPAs promote mitophagy by recruiting Parkin to the mitochondria. PSPAs-conferred mitophagy increased mitochondrial membrane potential and decreased mitochondrial reactive oxygen species and mitochondrial DNA, resulting in impaired NLRP3 inflammasome activation. In addition, the promotion of mitophagy by PSPAs required the Nrf2 signaling pathway. Collectively, these findings suggest that PSPAs are a potential option for the treatment of KP infection.