Both China and Taiwan were under Qing dynasty- the last dynasty in China- for many decades.
Taiwan is an island nation in East Asia. In the 17th century, the ruler of Qing dynasty extended its territory and included Taiwan under the mainland China. However, it was lost its sovereignty over Taiwan to Japan following the Sino-Japanese war in 1895.
The Republic of China (ROC) was formed by the Nationalist Party of China also known as Kuomintang in 1911. The Nationalist Party of China was the first organization to end hereditary monarch system in China in the year 1912.
Taiwan was under Japan until the end of the Second World War in 1945. At the end of the war, when Japan was defeated by the allies group it handed over Taiwan again to the ROC.
The ROC government ruled over the country until the end of Chinese Civil War in 1949.
In 1949, the Communist Party of China came to the power and formed the People's Republic of China (PRC). The entire mainland China was then under PRC. Only Taiwan was under the ROC.
The dispute between the ROC and the PRC is still going on as PRC claims its sovereignty over Taiwan.
The PRC, the existing government of China, wants to reunify Taiwan with mainland China under the policy of "One country, two systems".
But in Taiwan, there are two groups- the Pan-Blue Coalition ( mostly Kuomintang) and Pan-Green Coalition (mostly Democratic Progressive Party)- with different opinions.
The Pan-Blue Coalition supports reunification of China but wants the entire country to be under ROC's control. The Pan-Green Coalition considers Taiwan as an independent nation and wants official independence.
But PRC is not ready to give official independence to Taiwan. Even though Taiwan is entirely self-governing, it is prohibited from being a part of many global organizations such as United Nations.
The ROC has its own constitution, armed forces, and independently elected president and acts as a sovereign state.
Both the states use the word China in their official name. Officially, China is known as People's Republic of China (PRC) and Taiwan is known as Republic of China (RPC).