Objectives: The causal associations of physical activity and sedentary behavior with the risk of gastrointestinal disease is unclear. We performed a Mendelian randomization analysis to examine these associations. Methods: Genetic instruments associated with leisure screen time (LST, an indicator of a sedentary lifestyle) and moderate-to-vigorous intensity physical activity (MVPA) at the genome-wide significance (P<5E-8) level were selected from a genome-wide association study (N<703,901). Summary statistics for gastrointestinal diseases were obtained from the UK Biobank study (N>330,000), the FinnGen study (N>220,000), and large consortia. Multivariable MR analyses were conducted for genetically determined LST with adjustment for MVPA and vice versa. We also performed multivariable MR with adjustment for genetically proxied smoking, body mass index (BMI), fasting insulin, and type 2 diabetes for both exposures. Results: Genetically proxied longer LST was associated with increased risk of gastrointestinal reflux, gastric ulcer, duodenal ulcer, chronic gastritis, irritable bowel disease, diverticular disease, Crohn disease, non-alcoholic fatty liver disease, alcoholic liver disease, cholecystitis, cholelithiasis, acute pancreatitis, chronic pancreatitis, and acute appendicitis. Most associations remained after adjustment for genetic liability to MVPA. Genetic liability to MVPA was associated with decreased risk of gastroesophageal reflux, gastric ulcer, chronic gastritis, irritable bowel syndrome, cholelithiasis, and acute pancreatitis. The associations attenuated albeit directionally remained after adjusting for genetically predicted LST. Multivariable MR analysis found that BMI and type 2 diabetes mediated the associations of LST and MVPA with several gastrointestinal diseases. Conclusion: The study suggests that a sedentary lifestyle may play a causal role in the development of many gastrointestinal diseases.