Background: The incidence of metabolic dysfunction-associated steatohepatitis (MASH)-related hepatocellular carcinoma (HCC) is increasing annually with a rise in the incidence of obesity and metabolic syndrome. Based on preliminary reports regarding the potential association of HCC and periodontitis, this study aimed to analyze the involvement of periodontal bacteria as well as the oral and intestinal bacterial flora in MASH-related HCC (MASH-HCC). Methods: Forty-one patients with MASH and 19 with MASH-HCC who completed survey questionnaires, underwent periodontal examinations, and subjected to sample collection (saliva, mouth-rinsed water, feces, and peripheral blood) participated in the study. Bayesian network analysis was used to analyze the causation between various factors, including MASH-HCC, examinations, and bacteria. Results: The occupancy rate of the genus Fusobacterium in the intestinal bacterial flora was significantly higher in in the MASH-HCC group than in the MASH group (p = 0.002), whereas that of Butyricicoccus (p = 0.022) and Roseburia (p < 0.05) was significantly lower. Bayesian network analysis revealed the absence of periodontal pathogenic bacteria and enteric bacteria affecting HCC. However, HCC directly affected the periodontal bacterial species Porphyromonas gingivalis, Tannerella forsythia, Fusobacterium nucleatum, and Prevotella intermedia in the saliva, as well as the genera Lactobacillus, Roseburia, Fusobacterium, Prevotella, Clostridium, Ruminococcus, Trabulsiella, and SMB53 in the intestine. Furthermore, P. gingivalis in the oral cavity directly affected the genera Lactobacillus and Streptococcus in the intestine. Conclusion: MASH-HCC directly affects periodontal pathogenic and intestinal bacteria, and P. gingivalis may affect the intestinal bacteria associated with gastrointestinal cancer.