Hepatocellular carcinoma (HCC), being ranked as the top fifth most prevalent cancer globally, poses a significant health challenge, with a considerable mortality rate. Hepatitis B virus (HBV) infection stands as the primary factor contributing to HCC, presenting substantial challenges in its treatment. This study aimed to identify lactic acid bacteria (LAB) with anti-HBV properties and evaluate their impact on the intestinal flora in HBV-associated HCC. Initially, two LAB strains, Levilactobacillus brevis SR52-2 (L. brevis SR52-2) and LeviLactobacillus delbrueckii subsp. bulgaicus Q80 (L. delbrueckii Q80), exhibiting anti-HBV effects, were screened in vitro from a pool of 498 LAB strains through cell experiments, with extracellular expression levels of 0.58 ± 0.05 and 0.65 ± 0.03, respectively. These strains exhibited the capability of inhibiting the expression of HBeAg and HBsAg. Subsequent in vitro fermentation, conducted under simulated anaerobic conditions mimicking the colon environment, revealed a decrease in pH levels in both the health control (HC) and HCC groups influenced by LAB, with a more pronounced effect observed in the HC group. Additionally, the density of total short-chain fatty acids (SCFAs) significantly increased (p < 0.05) in the HCC group. Analysis of 16S rRNA highlighted differences in the gut microbiota (GM) community structure in cultures treated with L. brevis SR52-2 and L. delbrueckii Q80. Fecal microflora in normal samples exhibited greater diversity compared to HBV-HCC samples. The HCC group treated with LAB showed a significant increase in the abundance of the phyla Firmicutes, Bacteroidetes and Actinobacteria, while Proteobacteria significantly decreased compared to the untreated HCC group after 48 h. In conclusion, the findings indicate that LAB, specifically L. brevis SR52-2 and L. delbrueckii Q80, possessing antiviral properties, contribute to an improvement in gastrointestinal health.