No, Hong Kong is not a country. Hong Kong is a special administrative region of China. Hong Kong’s status as a special administrative region stems from its history as a former British colony.
By way of treaty or lease with China, the islands and mainland area now known as Hong Kong came under the control of Great Britain at various points in the 19th century. From that time until its transfer back to China in the late 20th century, Hong Kong developed on a different trajectory, both politically and economically, than mainland China—which, in contrast to Hong Kong’s status as a British colony, began that period with its imperial dynasty in decline and ended it as a republic under communist rule.
Spurred by the pending expiration of a 99-year lease (1898–1997) for part of the territory, the 1984 Chinese-British joint declaration paved the way for all of Hong Kong to be returned to China. The handover occurred on July 1, 1997, at which point the Basic Law of the Hong Kong Special Administrative Region took effect. The Basic Law outlined the concept of “one country, two systems,” under which Hong Kong, though now part of China, was allowed to maintain its capitalist economy and to retain a large degree of political autonomy (except in matters of foreign policy and defense) for a period of 50 years.