Pulmonary fibrosis is a terminal lung disease characterized by fibroblast proliferation, extracellular matrix accumulation, inflammatory damage, and tissue structure destruction. The pathogenesis of this disease, particularly idiopathic pulmonary fibrosis (IPF), remains unknown. Macrophages play major roles in organ fibrosis diseases, including pulmonary fibrosis. The phenotype and polarization of macrophages are closely associated with pulmonary fibrosis. A new direction in research on anti-pulmonary fibrosis is focused on developing drugs that maintain the stability of the pulmonary microenvironment. We obtained gene sequencing data and clinical information for patients with IPF from the GEO datasets GSE110147, GSE15197, GSE24988, GSE31934, GSE32537, GSE35145, GSE53845, GSE49072, GSE70864, and GSE90010. We performed GO, KEGG enrichment analysis and GSEA analysis, and conducted weighted gene co-expression network analysis. In addition, we performed proteomic analysis of mouse lung tissue. To verify the results of bioinformatics analysis and proteomic analysis, mice were induced by intratracheal instillation of bleomycin (BLM), and gavaged for 14 days after modeling. Respiratory function of mice in different groups was measured. Lungtissues were retained for histopathological examination, Western Blot and real-time quantitative PCR, etc. In addition, lipopolysaccharide, interferon-γ and interleukin-4 were used to induce RAW264.7 cells for 12h in vitro to establish macrophage inflammation and polarization model. At the same time, HG2 intervention was given. The phenotype transformation and cytokine secretion of macrophages were investigated by Western Blot, RT-qPCR and flow cytometry, etc. Through bioinformatics analysis and experiments involving bleomycin-induced pulmonary fibrosis in mice, we confirmed the importance of macrophage polarization in IPF. The analysis revealed that macrophage polarization in IPF involves a change in the phenotypic spectrum. Furthermore, experiments demonstrated high expression of M2-type macrophage-associated biomarkers and inducible nitric oxide synthase, thus indicating an imbalance in M1/M2 polarization of pulmonary macrophages in mice with pulmonary fibrosis. Our investigation revealed that the ethyl acetate extract (HG2) obtained from the roots of Prismatomeris connata Y. Z. Ruan exhibits therapeutic efficacy against bleomycin-induced pulmonary fibrosis. HG2 modulates macrophage polarization, alterations in the TGF-β/Smad pathway, and downstream protein expression in the context of pulmonary fibrosis. On the basis of our findings, we believe that HG2 has potential as a novel traditional Chinese medicine component for treating pulmonary fibrosis.