OBJECTIVES: While there is growing evidence that physical activity reduces the risk of hepatocellular carcinoma (HCC), the impact of occupational physical activity and sedentary behaviour remains unclear. This study aimed to investigate the associations between occupational physical activity and sedentary behaviour and HCC risk. DESIGN: Matched case-control study. SETTING: Nationwide multicentre, hospital-inpatient data set in Japan, from 2005 to 2021. PARTICIPANTS: The study included 5625 inpatients diagnosed with HCC and 27 792 matched controls without liver disease or neoplasms. Participants were matched based on sex, age, admission date, and hospital. PRIMARY MEASURES: The association between levels of occupational physical activity (low, medium, high) and sedentary time (short, medium, long) with the risk of HCC. SECONDARY MEASURES: Stratification of HCC risk by viral infection status (hepatitis B/C virus), alcohol consumption levels and the presence of metabolic diseases (hypertension, diabetes, dyslipidaemia, obesity). RESULTS: High occupational physical activity was not associated with HCC caused by hepatitis B/C virus infection in men. In women, high occupational physical activity was associated with a reduced risk of non-viral HCC, with ORs (95% CIs) of 0.65 (0.45-0.93). Among patients with non-viral HCC, medium occupational physical activity combined with medium alcohol intake further decreased the HCC risk in men with an OR of 0.70 (0.50-0.97), while high occupational physical activity combined with lowest alcohol intake decreased the HCC risk in women with an OR of 0.69 (0.48-0.99). Men and women with medium sedentary time had a lower HCC risk compared with those with long sedentary time, with ORs of 0.88 (0.79-0.98) in men and 0.77 (0.62-0.97) in women, respectively. In patients without viral infection or alcohol use, medium sedentary time reduced the HCC risk associated with fatty liver disease without comorbid metabolic diseases in women. CONCLUSIONS: High levels of occupational physical activity and/or medium periods of sedentary time are associated with a reduced risk of HCC, particularly non-alcoholic steatohepatitis.