It's well-known that some of Disney's greatest and friendliest movies draw from less than wholesome source material. Part of Disney's telltale magic is converting these fairy tales and folk stories into family-friendly fare that's accessible and entertaining.
On the other hand, investigating the potentially dark inspiration behind the movies helps us see them in entirely new ways. In the case of Aladdin, the fast-talking Genie that we know and love finds his roots in complex Arabian and Islamic figures known as the Djinn (pronounced jinn with a silent "D"). For an idea of their power, think back to the scene where Jafar becomes a fear-inducing Genie himself.
And that's not even close to what the Djinn are capable of. Here's how Genie is more closely related to the Devil than any wish-granting Fairy Godmother.
In the Islamic tradition, humans are made from clay, angels are made from light, and djinn are made from fire
That's often clarified as smokeless fire, to be exact. Djinn existed before humans, and there are even pre-Islamic texts from Asia and the Middle East that make reference to them.
The Djinn are sentient, mortal beings who notably possess free will
While Djinn are often compared to demons, that alignment can often confuse their true character. In some ways, they are actually closer to humans. Though they can take many forms, they can be good, evil, or somewhere in between, and they eventually die (albeit after an extremely long life relative to a human's). They each follow their own paths and have their own identities.
This is in contrast to the modern-day idea of a Genie, who are almost always shackled to their master (though it might explain why Genie was so adamant about doing his own thing).
There are many kinds of Djinn
Along with their individual differences, Djinn fall under different types. With gargantuan size and the power to grant wishes, Marid are considered the most powerful. Their pride often led to unknowing humans to make wishes with disastrous consequences, if the Marid didn't just kill them. In other words, Aladdin got off easy.
The cave-dwelling Ifrit would trick travelers into their homes. Supposedly, this would often lead to being coerced into marriage. The Shayitin are those devoted to making humans commit truly evil acts, and they are followers of, you guessed it, the Devil.
Iblis, the Quran's Satan figure, is actually a Djinn
That's right, Aladdin's partner-in-crime and that pesky red guy on your shoulder actually share a common ancestor. Iblis was a pious Jinni (the singular form), so Allah raised him to the territory of Angels. When Adam was created, Allah ordered everyone present to kneel. Feeling superior to the new creation, Iblis denied Allah and was sentenced to Hell.
Allah renamed him Shaytan, and the peeved Devil figure felt like his sentence was inevitable. In response, Shaytan chose to spend his time until Judgment Day trying to lure people into Hell. Not exactly a Disney sidekick (though, we did see a villain with a similar aim in Hades).
The path to "Genie"
As you can see, the Djinn are decidedly more autonomous than the imprisoned genies with whom we are most familiar. Though some of them did have the power over wishes, this usually spelled doom for the wisher, not fortune.
King Solomon was a figure who could control the Djinn, as they are very susceptible to magic (especially entrapment in innocuous containers). This power of control most likely became grander with the oral tradition of folk tales, starting with stories of humans outsmarting the Djinn in their tricks. More often than not, these guys just wanted to be freed from their prisons, and that's where the most clear line to Aladdin remains.
From this perspective, perhaps the entire plot of Aladdin was just Genie's ruse to get the chance to go to Disney World. I don't think anyone would hold that against him.