Objective Using bioinformatics methods to screen key aging-related genes and explore the mechanisms of aging, as well as the association between aging-related pathways and cognition. Methods Aging-related microarray data of rat hippocampal samples were downloaded from the GEO database. The R programming language was used to screen differentially expressed genes (DEGs), followed by Gene Ontology (GO) functional enrichment analysis and Kyoto Encyclopedia of Genes and Gnomes (KEGG) pathway analysis. The STRING 12.0 database was employed to construct protein-protein interaction (PPI) networks, and Cytoscape software with the CytoHubba plugin was used to analyze hub genes in the PPI networks for screening key aging-related genes. Results In the GSE5666 dataset, 23 upregulated aging-related DEGs were identified, while no downregulated aging-related DEG or cognition-related DEG was found. In the GSE9990 dataset, 70 upregulated and 9 downregulated aging-related DEGs were screened. GO functional enrichment analysis showed that the above DEGs were primarily involved in biological processes such as antigen processing, adaptive immune response, and immunoglobulin-mediated immune response. KEGG pathway analysis indicated that the DEGs were mainly enriched in infection- and immunity-related pathways. Through PPI network analyses, four common key genes were identified in the GSE9990 and GSE5666 datasets: Cd74, RT1-Da, C1qb, and Ctss. Conclusion Immune responses involving major histocompatibility complex class Ⅱ are associated with aging in rats, but aging-related genes may not necessarily be linked to cognitive function deficits.