Portugal staked out Macau as a colony around the year 1510, as a trading post. It is the earliest European colony in east Asia. Macau flourished at first, but in later years had conflict after conflict with China and Spain. In the 19th century Macau struggled in the shadow of Hong Kong, which had a much stronger economy. Gambling was legalized in the 1850's, although it wasn't until Macau was easily reachable by boat that it helped much.
In the latter years Portugal wasn't much interested in Macau, and they offered it back to China, but Beijing preferred the status quo. Eventually a deal was made ceding control of Macau back to China on December 20, 1999. Under the terms of the treaty, Macau would join Hong Kong as a Special Administrative Region, or SAR. If you ask about the influence of China on Macau, you will never get the same answer twice. My understanding is that China has a heavy hand in picking the highest local leaders, but otherwise politics are locally run. Although China is a communist country, at least in name, by the terms of the handover treaties, both Hong Kong and Macau remain open to free enterprise.
Hong Kong and Macau both have independent currencies, although they exchange very closely to the Chinese Yuan. Citizens do have Chinese passports, but with SAR status, that lets them freely travel to western countries. In the Olympics, Hong Kong and Macau play for their own teams, announced as "China - Hong Kong", for example. Traveling to or from mainland China to Hong Kong or Macau is like crossing a border to another country. About the only political influence of mainland China on either SAR, the average tourist will detect, is a Chinese flag over some government buildings.