Gastric cancer (GC) is the most common malignant tumor in the digestive system, traditional radiotherapy and chemotherapy are not effective for some patients. The research progress of immunotherapy seems to provide a new way for treatment. However, it is still urgent to predict immunotherapy biomarkers and determine novel therapeutic targets. In this study, the gene expression profiles and clinical data of 407 stomach adenocarcinoma (STAD) patients were downloaded from The Cancer Genome Atlas (TCGA) portal, and the abundance ratio of immune cells in each sample was obtained via the “Cell Type Identification by Estimating Relative Subsets of RNA Transcripts (CIBERSORT)” algorithm. Five immune cells were obtained as a result of abundance comparison, and 295 immune-related genes were obtained through differential gene analysis. Enrichment, protein interaction, and module analysis were performed on these genes. We identified five immune cells associated with infiltration and 20 hub genes, of which five genes were correlated with overall survival. Finally, we used Real-time PCR (RT-PCR) to detect the expression differences of the five hub genes in 18 pairs of GC and adjacent tissues. This research not only provides cellular and gene targets for immunotherapy of GC but also provides new ideas for researchers to explore immunotherapy for various tumors.