The incidence of chronic diseases is on the rise worldwide, with a high mortality rate in China, posing a serious threat to the health-related quality of life (HRQoL) of middle-aged and older adults. This study explores the association between chronic diseases and the HRQoL of middle-aged and older adults, as well as the role of physical activity (PA) and degree of digitization in this relationship. The data used in this study was obtained from the 2018 China Health and Retirement Longitudinal Study (CHARLS), which included 13,620 middle-aged and older Chinese adults (≥ 45 years). The study utilized correlation analysis, and bootstrapping to investigate the mediating role of PA and the moderating influence of the degree of digitization. Data analysis was conducted using SPSS 26.0. The study findings indicate that the severity of chronic disease has a significant negative predictive effect on HRQoL (PCS, physical component summary; MCS, mental component summary) (PCS: β = -2.515, p < 0.01, MCS: β = -0.735, p < 0.01). Further analysis revealed that PA plays a mediating and masking role in the impact of chronic disease on PCS and MCS. Additionally, the degree of digitization moderates the relationship between chronic disease and PA, chronic disease and PCS, and PA and PCS. For middle-aged and older persons, chronic diseases have a detrimental effect on their HRQoL; nevertheless, PA can help. Furthermore, proper internet usage can help older individuals to some extent in mitigating the negative impact of chronic diseases. Therefore, it is encouraged to promote PA among the elderly with chronic diseases to improve their physical health, as well as to guide them in the proper use of the Internet to establish healthy behaviors.