From the Super Mario Wiki
The Crystal Coconut is an extremely powerful item in the Donkey Kong franchise.
Donkey Kong Country television series
The Crystal Coconut first appeared in the Donkey Kong Country TV series. Its history on the show was that it was stolen from an unknown source by the great-great-grandfather of one of the show's main characters, Kaptain Skurvy. Skurvy's great-great-grandfather hid the Coconut on Kongo Bongo Island, specifically in the eye of the mystical idol Inka Dinka Doo. However, after many years the coconut pops out of its hiding place and is found by Donkey Kong, who is then proclaimed the future ruler of Kongo Bongo Island. The show's main antagonists King K. Rool and the aforementioned Kaptain Skurvy constantly try to steal the coconut from the Kongs; the former wants to use it to take over Kongo Bongo Island; the latter believes it is his birthright as his ancestor stole the Coconut, and seems to want to use it to "rule the seven seas" as well.
The Coconut's powers in the show range widely. It is known to be able to heal wounds, turn people invisible, freeze time (though living animals are unaffected), put someone in an endless sleep, and occasionally characters can look into it (like a crystal ball) and see whatever they wish to know. Occasionally the Coconut projects images on its own, often warning the Kongs when Kaptain Skurvy and his crew are returning to Kongo Bongo Island (this may suggest that the coconut possesses some level of intelligence). Cranky Kong seems to be able to use the coconut to teleport (in an astral form) to different places, though he must always return to where the Coconut is, even if it has been removed from its original location. For the duration of the show, the Crystal Coconut is kept in Cranky Kong's Cabin, inside a safe disguised as a celestial globe. The only way to open the safe is for Cranky to tap his cane on the ground, but many times Cranky opens the safe unintentionally.
Donkey Kong 64
In Donkey Kong 64, Crystal Coconuts are used as fuel for each Kong's Kong Barrel ability. For example, Donkey Kong's Strong Kong ability allows him to become invincible, but uses up Crystal Coconuts. They are semi-common items that appear in most levels, especially in areas requiring the Kongs to use their ability. When a Kong learns their ability from Cranky's Lab, the Crystal Coconuts become activated. At first, the Kongs can only carry up to 20 Crystal Coconuts, though for each Banana Fairy captured, one more gets added to their total. By capturing all 20 Banana Fairies, the Kongs can carry up to 40 Crystal Coconuts, exactly double of the default limit.
When the player captures every Banana Fairy, they unlock a cheat from the Mystery menu that allows them to use indefinite Crystal Coconuts. In some cases, such as the final battle against King K. Rool, the Kongs already use their Kong Barrel ability on an indefinite supply of Crystal Coconuts.
DK: King of Swing
Donkey Kong Barrel Blast
Crystal Coconuts also appear in the game Donkey Kong Barrel Blast. They are one of the items that come out of Red Item Balloons. If the player gets one, they will be invincible, have unlimited Wild Moves and can also hurt other racers by simply touching them. Unlike most other items obtained from a Red Item Balloon, it doesn't get an effect boost if a Kong uses one.