From Wikipedia:
Origin
The origin of the plant is the subject of debate.[23][24][25] Many
authorities suggest an Indo-Pacific origin either around Melanesia and
Malesia or the Indian Ocean, while others see the origin in
northwestern South America.[23][24][25] The oldest fossils known of
the modern coconut date from the Eocene period from around 37 to 55
million years ago and were found in Australia and India. However,
older palm fossils like some of nipa fruit have been found in the
Americas.[25]
Dispersal
Main article: Genomics of domestication
Genomic analysis of cultivated coconut (Coco nucifera L.) has shed
light on the movements of Austronesian peoples. By examining 10
microsatelite loci, researchers found two genetically distinct
subpopulations of coconut – one originating in the Indian Ocean, the
other in the Pacific Ocean. However, admixture, the transfer of
genetic material, evidently occurred between the two populations.
Given that coconuts are ideally suited for ocean dispersal, it seems
possible that individuals from one population could have floated to
the other. However, the locations of the admixture events are limited
to Madagascar and coastal east Africa, and exclude the Seychelles.
This pattern coincides with the known trade routes of Austronesian
sailors. Additionally, a genetically distinct subpopulation of coconut
on the western coast of South America has undergone a genetic
bottleneck resulting from a founder effect; however, its ancestral
population is the Pacific coconut, which suggests Austronesian peoples
may have sailed as far east as the Americas.[26]
Distribution
The coconut has spread across much of the tropics, probably aided in
many cases by seafaring people. Coconut fruit in the wild are light,
buoyant and highly water resistant, and evolved to disperse
significant distances via marine currents.[27] Specimens have been
collected from the sea as far north as Norway.[28] In the Hawaiian
Islands, the coconut is regarded as a Polynesian introduction, first
brought to the islands by early Polynesian voyagers from their
homelands in Oceania.[16] They have been found in the Caribbean and
the Atlantic coasts of Africa and South America for less than 500
years, but evidence of their presence on the Pacific coast of South
America predates Christopher Columbus's arrival in the Americas.[24]
They are now almost ubiquitous between 26°N and 26°S except for the
interiors of Africa and South America.