Objective To explore the correlation and mechanism of ferroptosis with pulmonary fibrosis. Methods Pulmonary fibrosis tissue sequencing data were obtained from Gene Expression Omnibus and FerrDb databases from January 2019 to December 2023. Differentially expressed genes (DEGs) between the normal control group and the pulmonary fibrosis group were analyzed by bioinformatic method, and DEGs related to pulmonary iron addiction were extracted. The hub genes were screened by enrichment analysis, protein-protein interaction (PPI) analysis and random forest algorithm. The mouse model of pulmonary fibrosis was made for exercise intervention, and the expression of hub genes was verified by real-time quantitative reverse transcription polymerase chain reaction. Results A comparison of 103 patients with idiopathic pulmonary fibrosis and 103 normal lung tissues showed that 13 up-regulated genes and 7 down-regulated genes were identified as ferroptosis-related DEGs. PPI results showed that there was an interaction between these ferroptosis-related genes. The Kyoto Encyclopedia of Genes and Genomes pathway enrichment and Genome Ontology enrichment analysis showed that ferroptosis-related genes were involved in organic anion transport, hypoxia response, oxygen level reduction response, hypoxia-inducible factor-1 signaling pathway, renal cell carcinoma, and arachidonic acid metabolic signaling pathway. Genes identified by PPI analysis and random forest algorithm included CAV1, NOS2, GDF15, HNF4A, and CDKN2A. Real-time fluorescence quantitative polymerase chain reaction results of mouse fibrotic lung tissue showed that compared with the exercise group, the mRNA levels of NOS2, PTGS2 and GDF15 were up-regulated and the mRNA levels of CAV1 and CDKN2A were down-regulated in the bleomycin group (P<0.05); compared with the bleomycin group, the expression of CAV1 and CDKN2A increased and the expression of NOS2, PTGS2 and GDF15 decreased in the bleomycin + exercise group (P<0.05). Conclusions Bioinformatic analysis identifies 20 potential genes associating with ferroptosis in pulmonary fibrosis. CAV1, NOS2, GDF15, and CDKN2A influence the development of pulmonary fibrosis by modulating ferroptosis. Treadmill training can reduce ferroptosis in fibrotic tissues, thereby reducing lung inflammation.