This study evaluated the effect of sodium-glucose cotransporter-2 inhibitors (SGLT2i) on cancer development, particularly in hepatocellular carcinoma (HCC), in individuals with concomitant fatty liver disease (FLD) and type 2 diabetes mellitus (T2DM). Using data from Korea's Health Insurance Review and Assessment Service, we performed Kaplan–Meier and Cox regression analyses in patients with non-alcoholic fatty liver disease (NAFLD) and T2DM (NAFLD-T2DM cohort) and those with chronic viral hepatitis (CVH) alongside FLD and T2DM (FLD-T2DM-CVH cohort). In the propensity score (PS) matched NAFLD-T2DM cohort (N = 107,972), SGLT2i use was not associated with the occurrence of overall cancer, including HCC. However, old age, male sex, liver cirrhosis, and hypothyroidism were identified as independent risk factors for HCC occurrence, whereas statin and fibrate usage were associated with reduced HCC risk in this cohort in multivariate Cox analysis. In the PS-matched FLD-T2DM-CVH cohort (N = 2798), a significant decrease in HCC occurrence was observed among SGLT2i users (P = 0.03). This finding remained consistent in the multivariate Cox regression analysis (Hazard ratio = 2.21, 95% confidence interval = 1.01–4.85, P = 0.048). In conclusion, SGLT2i may be a beneficial option for diabetes management in patients with concomitant T2DM, FLD, and CVH while affirming the overall safety of SGLT2i in other types of cancer.