Gastric cancer (GC) is highly heterogeneous and influenced by aging-related factors. This study aimed to improve individualized prognostic assessment of GC by identifying aging-related genes and subtypes. Immune scores of GC samples from GEO and TCGA databases were calculated using ESTIMATE and scored as high immune (IS_high) and low immune (IS_low). ssGSEA was used to analyze immune cell infiltration. Univariate Cox regression was employed to identify prognosis-related genes. LASSO regression analysis was used to construct a prognostic model. GSVA enrichment analysis was applied to determine pathways. CCK-8, wound healing, and Transwell assays tested the proliferation, migration, and invasion of the GC cell line (AGS). Cell cycle and aging were examined using flow cytometry, β-galactosidase staining, and Western blotting. Two aging-related GC subtypes were identified. Subtype 2 was characterized as lower survival probability and higher risk, along with a more immune-responsive tumor microenvironment. Three genes (IGFBP5, BCL11B, and AKR1B1) screened from aging-related genes were used to establish a prognosis model. The AUC values of the model were greater than 0.669, exhibiting strong prognostic value. In vitro, IGFBP5 overexpression in AGS cells was found to decrease viability, migration, and invasion, alter the cell cycle, and increase aging biomarkers (SA-β-galactosidase, p53, and p21). This analysis uncovered the immune characteristics of two subtypes and aging-related prognosis genes in GC. The prognostic model established for three aging-related genes (IGFBP5, BCL11B, and AKR1B1) demonstrated good prognosis performance, providing a foundation for personalized treatment strategies aimed at GC.