This phase Ib/II trial studies the side effects and best way to give pembrolizumab with combination chemotherapy and radiation therapy before surgery and to see how well it works in treating adult patients with gastroesophageal junction or gastric cardia cancer that has spread from where it started to nearby tissue and can be removed by surgery. Monoclonal antibodies, such as pembrolizumab, may block tumor growth in different ways by targeting certain cells. Drugs used in chemotherapy work in different ways to stop the growth of tumor cells, either by killing the cells, by stopping them from dividing, or by stopping them from spreading. Radiation therapy uses high energy x-rays to kill tumor cells and shrink tumors. Giving pembrolizumab, combination chemotherapy, and radiation therapy before surgery may make the tumor smaller and reduce the amount of normal tissue that needs to be removed.