Viral infections of the upper gastrointestinal (GI) tract are not uncommon in clinical practice; however, these are frequently observed in immunocompromised patients and rarely in immunocompetent hosts. Compared with esophagitis, which may be associated with clinically significant outcomes, the stomach is a relatively rare site for opportunistic infections in immunocompetent patients. The most common clinically relevant upper GI tract viral infections include cytomegalovirus (CMV), Epstein-Barr virus (EBV), and herpes simplex virus infections. CMV esophagitis and gastritis, which primarily occur in immunocompromised patients, necessitate antiviral treatment, whereas immunocompetent patients typically respond to proton pump inhibitor administration. Most EBV-induced gastric infections are asymptomatic. However, EBV infection is a known etiological contributor to stomach cancer. EBV-associated gastric cancer shows distinctive clinical, pathological, genetic, and post-genetic mutation features and is therefore a clinically significant entity. Herpetic esophagitis usually affects immunocompromised patients and is uncommon in immunocompetent individuals. In this review, we discuss the general aspects and recent studies that have reported esophageal and gastric infections in immunocompromised patients.