Mainland China, also called the Chinese Mainland, is the part of China not including the Republic of China controlling Taiwan, Kinmen, Matsu, and the Pescadores. The term also excludes Hong Kong and Macau.
In the Qing Dynasty, all of Mainland China, Hong Kong, Macau, Taiwan, Kinmen, Matsu, the Pescadores, and Mongolia were part of the Chinese Empire. Taiwan, Hong Kong, and Macau were colonized by foreigners for some years (Taiwan to the Japanese, Hong Kong to the British, and Macau to the Portuguese).
By the end the Qing Empire, China became Nationalist China (the Republic of China) and it got Taiwan back in 1945. After the Communists (the People's Republic of China) took over most of China, the Nationalists kept only Taiwan, Kinmen, Matsu, and the Pescadores. Mongolia became an independent state later.
Later Hong Kong and Macau were returned to the government of China, but because the government calls them "special administrative regions" under a "one country, two systems" idea, they are still not thought of as part of Mainland China.