Background: Idiopathic pulmonary fibrosis (IPF) is an incurable lung disease characterized by progressive scarring leading to alveolar stiffness, and reduced lung capacity, which might be induced by Coronavirus Disease 2019 (COVID-19). This study aims to explore the molecular mechanism of COVID-19-induced IPF and find the immune changes in the process of IPF. Methods: The data from the GEO database were processed by using the R algorithm package to explore the correlation between COVID-19 and IPF. Differential analysis, Venn analysis, Gene Ontology (GO) and Kyoto Encyclopedia of Genes and Genomes (KEGG) analysis, immune infiltration analysis, transcriptional analysis, and protein-protein analysis were performed to find the candidate hub genes, related pathways, and immune cell changes in IPF. Results: 69 differentially expressed genes (DGEs) were identified by differential analysis, including 27 up-regulated genes and 42 down-regulated genes. 15 hub genes were identified, which are CEA Cell Adhesion Molecule 8 (CEACAM8), Cathelicidin Antimicrobial Peptide (CAMP), Ribosomal Protein L9 (RPL9), Lactotransferrin (LTF), CD177 Molecule (CD177), Annexin A3 (ANXA3), CD3 Delta Subunit Of T-Cell Receptor Complex (CD3D), Granulin Precursor (GRN), Granzyme A (GZMA), Granzyme K (GZMK), Interleukin 1 Receptor Type 2 (IL1R2), Lipocalin 2 (LCN2), Matrix Metallopeptidase 9 (MMP9), Neural EGFL Like 2 (NELL2) and Ribosomal Protein L4 (RPL4), among which ANXA3, IL1R2, MMP9, LCN2, NELL2 might be the most significant candidate genes for COVID-19-induced IPF. The transcriptional factors of hub genes were found to be related to Sp1 Transcription Factor (SP1), Signal Transducer And Activator Of Transcription 1 (STAT1), RELA Proto-Oncogene, NF-KB Subunit (RELA), and Nuclear Factor Kappa B Subunit 1 (NFKB1). Immune cell analysis revealed that Plasma cells, Macrophages MO, Dendritic cells activated, Mast cells resting, and Eosinophils were significantly elevated in the IPF compared with healthy subjects. Conclusions: The findings shed light on the risk factors of COVID-19 in the development of IPF, and immune changes in COVID-19 and IPF. The shared DEGs might be prognostic in the treatment of IPF.