There is a long history of conflict between the two groups- nationalists and communists- going back to 1911 over the war that began after the end of the Qing dynasty, China’s last kings in 1911. It continued till the end of WW 2 when the forces led by Mao defeated the Nationalists, who retreated and set up their state in Taiwan - officially the Republic of China. Mao and his forces meanwhile, established the People's Republic of China on the mainland in 1949. China wants to unite all of China under one flag while Taiwan wants to stay independent.
Read: Why Pelosi went to Taiwan, and why China’s angry
US-China relations
The US only recognized Taiwan at first, not engaging with Communist China and there have been some confrontational situations too, though relatively minor. In 1976, after Mao’s death Deng Xiaoping took over and began to open up China internally and internationally.
US President Jimmy Carter and Chinese leader Deng Xiaoping signed documents establishing formal diplomatic relations in 1979. The US recognized the 'one China' principle but due to public opinion pressure continued to supply arms to Taiwan for its self-defence. Posturing and show of strength has continued between the two.
In 2019, Xi Jinping - the current president of China said, "We make no promise to abandon the use of force, and retain the option of taking all necessary measures." China has said after Kabul’s fall that the US will not come to aid Taiwan as abandoning Kabul shows.
Reasons for the visit
Pelosi thus became the highest-ranking US official since 1997 to visit Taiwan. A critic of China’s for a long time including on human rights, the trip is her big act before retirement. Biden has egged her on as a Democrat. It makes the US look strong as the Democrats await a shellacking in November's mid-terms.
The visit was badly timed as Xi has been focusing on unifying China, meaning takeover of Taiwan officially, by force if need be, as part of his tasks. He has reacted sharply saying, 'those who play with fire will die by it'.
Xi ordered six days of military drills to take place around Taiwan to show its strength.
Given the Russo-Ukraine war, the situation is worrying. Superpowers are unreliable and egotistic forces. China putting all global eggs in one China basket is dangerous and US retaliation in several forms is a possibility that is even worse. Uncertainty is higher in this theatre than ever before. If there is a confrontation, the price will be global and may be even higher than the Russo-Ukraine war.