Special Administrative Region

A Special Administrative Region (SAR) is a region in China that has a high level of autonomy, or a lot of power to rule itself. There are two SAR's in China, Hong Kong and Macau. Unlike other regions in mainland China, SAR's have a Basic Law, a constitution that is different from that of the People's Republic of China (PRC). Basic Law allows Hong Kong and Macau to have freedoms that are not in the rest of China, like freedom of religion, freedom of speech, freedom of the Press, freedom of assembly, and freedom to petition. Basic Law also allows the SAR's to decide the economic rules of their region, which is why the economies are a lot less controlled in Hong Kong and Macau than in mainland China, as well as giving them the freedom to choose who to let into their own regions without needing a visa. As a result, Hong Kong and Macau have their own currencies, passports, official languages, etc. This is commonly known as the "one country, two systems" policy.
Chinese is an official language in both SAR's, but unlike mainland China where Mandarin is the main spoken language and simplified Chinese is the main written language, Cantonese is the most spoken language and traditional Chinese is the main written language in these areas. The vagueness of simply stating Chinese as the official language allows this to happen. Also, English and Portuguese, the main languages of the nations that controlled Hong Kong and Macau in the past in respective order, are also official languages in the respective SAR's.
History
After the British Empire defeated China in the Opium Wars, China was forced to give up Hong Kong to the British after signing unequal treaties that favored British interests. They had to give up control of Hong Kong Island in 1842, Kowloon Peninsula in 1860, and were made to lease New Territories for a period of 99 years in 1898. In the 1980s, when its lease of New Territories was nearly over, the United Kingdom sought to renew its lease of New Territories. However, China refused to renew the lease. Since New Territories had half of Hong Kong's people and most of its water supply, having Kowloon and Hong Kong Island without New Territories would have ruined Hong Kong's economy. Reluctantly, Britain decided in 1984 to begin talks on giving Hong Kong back in 1984. In 1988, China agreed to uphold Basic Law, which would make Hong Kong into an SAR when it gets returned to China, and in 1997, Hong Kong was returned to the PRC.
IN 1557, the Portuguese Empire made a permanent settlement on Macau, after being given permission from China to dock and trade there. However, it took over Taipa in 1951 and Coloane in 1864, and in 1887, China was forced to sign a treaty to make Macau a permanent colony of Portugal. However, after a military coup overthrew the Portuguese government in 1974, the new government made a promise to give back all the lands it took overseas. In 1986, Portugal and China began talks on how to bring control of Macau back to China peacefully, and in 1999, Macau became an SAR in the PRC.
Regional status in China
As SAR's, China agrees that "commercial, social and legal life of Hong Kong/Macau will remain as it is" until after their first 50 years of being part of the PRC. For Hong Kong, its uninterrupted status will last until 2047, and for Macau, it will last until 2049. Afterwards, the PRC is allowed to rule over Hong Kong and Macau as it pleases.