It's my understanding that the idea of a genie comes from the Islamic concept of the Jinn but where does the "three wishes" that's so pervasive in popular culture come from?
In popular western culture they come from stories from the Thousand and One Nights, which were widely translated and read across Europe.
The Thousand and One Nights dates to Sassanid Persia around the 5th-6th century AD, before the Islamic conquest. The stories had various supernatural beings, which were translated as "Jinn" when these stories reached the Muslim world.
If you go back farther, the Thousand and One Nights is itself based on the Indian Panchtantra, which was compiled by Vishnu Sharma around 300 BC, from stories that go back to an even earlier age. Lots of stories from the Panchtantra made their way to the Islamic world via Thousand and One Nights, and to Europe through Grimm and Anderson.
Although the stories have been modified by different cultures they passed through, the same motifs remain. For example, the Jinn and the 3 wishes have a parallel in the story of the two-headed woodcutter from the Panchtantra. He is about to chop down a tree, but a spirit lives in the tree and offers to fulfill any wish if he spares the tree. So the woodcutter agrees, but tells the spirit "let me go home and consult with my family, and I'll be back tomorrow to tell you what my wish will be". And he goes back and consults with 3 people, which is one too many because the third gives him bad advice and his wish backfires on him. The moral is the same: "be careful what you wish for".