Gastric cancer is a significant health concern worldwide. Helicobacter pylori (HP) infection is associated with gastric cancer risk, but differences between HP-infected and HP-free gastric cancer have not been studied sufficiently. The objective of this study was to investigate the effects of HP infection on the viability and migration of gastric cancer cells and identify potential underlying genetic mechanisms as well as their clinical relevance. Cell counting kit-8, lactate dehydrogenase, wound healing, and transwell assay were applied in the infection model of multiple clones of HP and multiple gastric cancer cell lines. Genes related to HP infection were identified using bioinformatics analysis and subsequently validated using real-time quantitative PCR. The association of these genes with immunity and drug sensitivity of gastric cancer was analyzed. Results showed that HP has no significant impact on viability but increases the migration of gastric cancer cells. We identified 1405 HP-upregulated genes, with their enriched terms relating to cell migration, drug, and immunity. Among these genes, the 82 genes associated with survival showed a significant impact on gastric cancer in consensus clustering and LASSO prognostic model. The top 10 hub HP-associated genes were further identified, and 7 of them were validated in HP-infected cells using real-time quantitative PCR, including ERBB4, DNER, BRINP2, KCTD16, MAPK4, THPO, and VSTM2L. The overexpression experiment showed that KCTD16 medicated the effect of HP on gastric cancer migration. Our findings suggest that HP infection may enhance the migratory potential of gastric cancer cells and these genes might be associated with immunity and drug sensitivity of gastric cancer. In human subjects with gastric cancer, HP presence in tumors may affect migration, immunity, and drug sensitivity.