From Monkey Island wiki
Root beer is a fizzy drink that is shown to have special voodoo powers. In his first confrontation with the Ghost Pirate LeChuck, Guybrush Threepwood is told that only a special Voodoo Anti-root potion has the power to destroy spirits and defeat LeChuck. Although he is required to find a special root so rare that only one known specimen remains, later on any kind of readily available root beer seems to have the same effect.
Used against LeChuck
After LeChuck has kidnapped Governor Marley in The Secret of Monkey Island, Guybrush's newfound love interest, the Voodoo Lady on Mêlée Island informs him that the only way to defeat the Ghost Pirate is with a special potion made from a particular root guarded by the Cannibals who live on Monkey Island, which is also where LeChuck has his base. The Voodoo Lady reads Guybrush's future but is unable to tell whether the Cannibals will help Guybrush, or eat him. She also foresees him inside a giant monkey.
When Guybrush finds the Cannibals they reveal that LeChuck stole the root and has it hidden on his ghost ship, anchored in a river of lava deep beneath the island. They lend Guybrush their Navigator Head, with which Guybrush can find his way through the labyrinthine caverns beneath the Giant Monkey Head. He sneaks onboard the ghost ship and steals the root, which the Cannibals use to make the special potion in a seltzer bottle; Red Skull points out that if there's any left over, it makes a great float with some vanilla ice cream (hinting for the first time that the concoction is the equivalent of simple root beer).
Guybrush follows LeChuck back to Mêlée Island where he uses the potion to dissolve some of LeChuck's minions on his way through town to the church. He interrupts LeChuck's wedding ceremony only to find that Elaine had already escaped. The figure in the bridal gown turns out to be two monkeys holding their own ghost-zapping potion, but Guybrush scares them away and Elaine must chase after them. LeChuck proceeds to punch Guybrush high into the air, sending him all over the island and lose the potion somewhere over the island. Eventually Guybrush lands in the Grog Machine at Stan's Used Ship Emporium where LeChuck lands, dispatches Stan and pulls Guybrush out of the machine. Guybrush grabs a stray bottle of root beer and sprays LeChuck, destroying his ghostly essence and causing it to explode magnificently all over the night sky.
Used against Guybrush
In Monkey Island 2: LeChuck's Revenge, Guybrush knocks himself out and falls into a strange dream that ends with the approach of the Zombie Pirate LeChuck, who transforms into Guybrush as seen in the first game and sprays the real Guybrush with the ghost-zapping potion, ending the dream.
In "Rise of the Pirate God", the fifth and final chapter of Tales of Monkey Island, Guybrush manages to escape the Crossroads only to find himself on LeChuck's ship, unable to grab the Cursed Cutlass of Kaflu in his ghostly state. Elaine turns on Guybrush, becoming LeChuck's demon bride and spraying her dead husband with root beer, sending him back to the Crossroads in great pain. He eventually manages to repossess his dead body, protecting him against this attack. Leaky barrels of root beer in Club 41 are a special concern to Guybrush.
Root beer seems to have special powers beyond destroying ghosts. When Guybrush pours some over some old, already-been-chewed spirit gum in the Flotsam Island Jail, it regains its voodoo powers. (In the PS3 version, having Guybrush pour the root beer on the gum wads to create Spirit Gum and then eat it earns the player both the bronze trophy called "The Violet Beauregarde Memorial Trophy" (in reference to the character from Roald Dahl's novel Charlie and the Chocolate Factory) and the "I Ain't Got No Body" silver trophy (in reference to the song) in the "PlayStation Network Trophy Achievements".)
Enchanted root beer is the final ingredient needed to make the Cursed Cutlass of Kaflu. In "Launch of the Screaming Narwhal", at the opening of Tales of Monkey Island, Guybrush spills his supply when LeChuck rams their ships together, so he substitutes by making some root grog on Elaine's ship. The Voodoo Lady later states that the Cutlass would have destroyed LeChuck if the ingredients hadn't been swapped; instead, LeChuck is turned into a human as all his voodoo escapes and infects other pirates.