The aim of this study is to explore the key mechanisms of perioperative neurocognitive dysfunction (PND) after anesthesia/surgery (A/S) by screening hub genes. Transcriptome sequencing was conducted on hippocampal samples obtained from 18-month-old C57BL/6 mice assigned to control (Ctrl) and A/S groups. The functionality of differentially expressed genes (DEGs) was investigated using Metascape. Hub genes associated with changes between the two groups were screened by combining weighted gene coexpression network analysis within CytoHubba. Reverse transcription PCR and western blotting were used to validate changes in mRNA and protein expression, respectively. NLRP3 inflammasome activation was detected by western blotting and ELISA. Tauroursodeoxycholic acid (TUDCA), an inhibitor of endoplasmic reticulum (ER) stress, was administrated preoperatively to explore its effects on the occurrence of PND. Immunofluorescence analysis was performed to evaluate the activation of astrocytes and microglia in the hippocampus, and hippocampus-dependent learning and memory were assessed using behavioral experiments. In total, 521 DEGs were detected between the control and A/S groups. These DEGs were significantly enriched in biological processes related to metabolic processes and their regulation. Four hub genes (Hspa5, Igf1r, Sfpq, and Xbp1) were identified. Animal experiments have shown that mice in the A/S group exhibited cognitive impairments accompanied by increased Hspa5 and Xbp1 expression, ER stress, and activation of NLRP3 inflammasome. Inhibiting ER stress alleviated cognitive impairment in A/S mice; particularly, ER stress induced by A/S results in NLRP3 inflammasome activation and neuroinflammation. Moreover, the preoperative administration of TUDCA inhibited ER stress, NLRP3 inflammasome activation, and neuroinflammation.