Why was Taiwan named Taiwan?

Because the capital is called Taipei so they decided to name it after the capital

<<<<

the answer above is not quite right.

the reasons are likely to be:

1. there used to be many immigrants form south east mainland china during the period form 16th century to 18th century and many of them died when crossing the Taiwan strait. so, Taiwan became a place many people died of despite and the pronunciation of "die of despite" in Minnan, a kind of Chinese dialect. thus, Taiwan is so called .

2. the very first place that immigrants disembark form ships was called "Teowan", which was said to be the residence of a division of Plain Aboriginals in Taiwan.
=====================
Answers above are wrong and baseless. Taiwan was first known as "Tayouan." It is believed to be derived from the word "Taian" or "Tayan," which mean "foreigner" in Formosan language spoken by the Siraya people, an indigenous people in Taiwan.

During the Dutch Formosa era, Taiwan was then called "Taioan," which was derived from the Minnan pronunciation of "Tayouan," and later became "Taiwan."