1)The HK banking system is well trusted, so foreign firms are more willing to establish a HQ on chinese soil than else where.
2)HK enjoys generally good access to sensitive western technology which owner may not be happy exporting directly to China
3)HK is also a great place for the Chinese govt's higher up to launder their "black" money into a foreign currency
4)HK also contribute greatly to the Chinese economy, HK's GDP itself is.... greater than the entire philipines.. more than Israel or New Zealand.
5)HK also have a whole lot of mechant shipping with her flag, like... almost double the merchant tonnage of the entire PRC.
6)HK also have a massive foreign reserve, almost 300 trillion USD (more than germany, more than india) -> it lends a lot of trust into the HK banking system and also a reason why the recent direct Yen-Yuan currency exchange, HSBC was a fundamental part of it.
7)HK also provide a lot of technical expertise to China; e.g. how to build very tall buildings, or how to build large span bridges... There is a lot of HK based companies investing into every sector of chinese industry; from batteries, to tool and die.
8)there are also a lot of historical issues, from the ancient tombs in kowloon, to the defeat of the southern song fleet off the coast of HK, the opium war, to the revolutionary safe house of the xianhai revolution, to the exile HQ of sun yet san, to the smuggling of arms into China to fight the Japanese. HK played an intergral part in Chinese history.
All of these make it positive for China to maintain HK; Historically, China have 2 main ports, Shanghai and Canton; the later of which nowadays encompases - Macau, HK and Guangzhou city; HK is an estential part of that equation.