The Suez Crisis goes badly and all hell breaks loose in Malaya, showcasing the problems with Britain's power projection abilities in the late 1950s. This problem forces Britain to start allowing Hong Kong some degree of autonomy, as can easily run the place on their own but cannot assure its security if the PRC was to get into any fights with Britain, a point made clearer still after China's first nuclear bomb test in June 1964.
Britain's problems in the late 1960s see them focus on their efforts at home, and as a result Britain gives larger degrees of autonomy to Hong Kong in the 1970s, noticing that Singapore and Malaysia are doing quite alright for themselves. This causes China to be massively inward looking at the time, and an immense power struggle in the late 1970s after Mao's death. The chaos in China causes the idea of Britain giving the colony back to China to be dismissed out of hand. Hong Kong instead evolves through the 1980s, aiming to be fully independent by 1990. The British Government of the time agrees in theory, but sees the problem posed by China's militant government, which starting the early 1980s starts talking of taking Hong Kong and Macau back by force, as making it impossible to create an independent Hong Kong.
Somewhat ironically, the dilemna is solved by the United States. After restorations of relations with the Republic of China in 1992 following the collapse of the Soviet Union and the destruction of Subic Bay and Clark Air Base in the Philippines by the eruption of Mount Pinatubo in 1991, the United States elects to move its East Asia bases to Taiwan in 1992, and the year after that Hong Kong proposes the use of the territory as a naval installation in return for the United States and Hong Kong guaranteeing its sovereignty. Hong Kong sweetens the deal by beginning the construction of a facility on their own, and also begins negotiations with the UK over formal independence. China objects, but it doesn't seem to matter in Hong Kong, where even the overwhelming Chinese majority has little love to the People's Republic.
The deal is finally done in February 1994, with Hong Kong becoming an independent nation on July 1, 1997, with its security guaranteed by the United Kingdom and the United States, with the half-built naval base at Tui Min Hoi being transferred to the United States Navy and the Royal Navy on that date as well - by which point its construction has been finished.