Before the CCP existed, Taiwan was part of China, and was occupied for many years by Japan. After the Chinese civil war and the rise of the CCP, the defeated nationalist government moved to Taiwan. It is only then that any US alliance with Taiwan began.
China had never ruled over the island. It called it a province for ~ 7 years before Japan took Taiwan and actually ruled over it. The US was allied with KMT after they took over from the Qing dynasty. And continued to be allies after CCP pushed KMT out. When China attacked Taiwan the U.S. stepped in.