Genie was the centuries-old magical entity who first appeared in Duck Tales the Movie: Treasure of the Lost Lamp. Though his true origin on how he came to be was never a topic, it was eventually revealed that his latest master, Merlock, was an evil sorcerer who's first wish was for immortality. He possesses a powerful talisman that grants him an infinite amount of wishes when placed on the lid of the Genie's lamp, allowing him to force the Genie to do terrible things for as long as he desired. Then, a man who would later be known as one of the world's greatest thieves, Collie Baba, stole the lamp from Merlock and locked it with the rest of his treasure, deep inside a dangerous pyramid in Egypt. Scrooge McDuck would find this treasure, along with the lamp, centuries later.
Merlock's evil ways traumatized the Genie enough for him to realize that his one and only wish is simply to become a real boy.
In present times, he gets discovered by Uncle Scrooge's niece and three nephews, Webigail ("Webby"), Huey, Dewey, and Louie, after rubbing his lamp which Webby used as a teapot at first. The four Vanderquack siblings approached Genie regarding wishes, making them all instantly become his master who may each be granted three wishes.
Fearing he would gain publicity for his magical powers, Genie took on the disguise as a young boy and gained the alias "Gene", which was accidentally given to him by two of the boy ducklings when they almost revealed his true name to their Uncle Scrooge.
Also, Genie's former master tracked him down and using his magic talisman began casting evil wishes (the talisman allowed him to cast more the 3 wishes).
Uncle Scrooge later freed Genie with his final wish.