The Chinese government was never going to allow any genuinely democratic form of government in Hong Kong, because they fear it would increase support for democracy in the mainland.
Consequently it has also been systematically chipping away at the autonomy and independence Hong Kong usually has enjoyed, in an attempt to steer it towards something that looks superficially democratic yet is still under direct control of the Communist party. The most brazen of this was the kidnapping of Chinese political dissidents in Hong Kong and taking them to the Chinese mainland, but far less overt examples are probably more important.
In the end, if the protests continue long enough, China is almost certainly going to crack down and completely subject Hong Kong to martial law. Xi and the rest of the national leadership won't tolerate such an important and prominent part of the country appearing to be in open revolt. They have a need to show that rebellion and mass protests cannot work, ever.