The island carries a name that Marco Polo probably misapplied.
Etymonline states the origin plainly: the name comes from Mogadishu, a city in Somalia, because Marco Polo misread Arabic and thought the name belonged to the island. Wikipedia reports that in his 13th-century account he mentions "Madageiscar" south of Socotra.
Wikipedia is more cautious than Etymonline. It says the origin of the Western name is uncertain, likely foreign, and spread by Europeans in the Middle Ages. It lays out the Mogadishu idea as one hypothesis. It also records a Malay one tied to the Austronesian origins of the Malagasy. Al-Idrisi's 1154 map calls the island Gesira Malai, "Malay island," in Arabic, and Wikipedia says that may have led to the modern name.
Wikipedia also gives a later story, from a 1609 book, in which sultans of Mogadishu sailed there and carved "Magadoxo" on pillars. Wikipedia presents it as a much later account.
The European naming had a second stage. Wild Madagascar says the Portuguese captain Diogo Dias landed on August 10, 1500, after being blown off course on the way to India, and named the island St. Lawrence, in Portuguese São Lourenço. That name did not last. Wikipedia says Renaissance maps later popularized Madagascar, the name linked to Polo.
The island itself had no single name that Europeans could have borrowed. Etymonline and Wikipedia both say that no single local name for the whole island is known. Today the Malagasy name is Madagasikara, per Wikipedia.
Etymonline dates the adjective Malagasy to 1835 and says it probably alters Madagascar. So the English name for the people comes from the island's borrowed name.