Ali Baba was a heroic individual from the past who fought against a previous incarnation of the Forty Thieves.
Little is known about Ali Baba except that he fought and presumably defeated a past incarnation of the Forty Thieves and his adventure was later magically preserved in story by the legendary queen Scheherazade. It was either before or around this time that a ship that contained the legendary Hand of Midas sank in the waterways of the hideout of the Forty Thieves and a mural explaining the secrets of the Hand were carved within the deepest chambers of the hideout by an unknown individual or group, although whether Ali Baba had anything to do with this remains unknown.
At some point after Ali Baba's era, the old hideout of the Forty Thieves was discovered by a man named Cassim who would end up becoming the King of Thieves after making his own successor to the Forty Thieves.
When the young street rat Aladdin discovered the all-powerful Genie, the genie briefly regaled him with the tale of Ali Baba and his Forty Thieves and assured him that with a genie's power up his sleeve, not even the Forty Thieves stood a chance. Whether Genie actually had met Ali Baba at some point or he simply knew about him due to magical foresight is anyone's guess.
Aladdin would later on discover the hideout of the Forty Thieves himself while searching for his father who turned out to be none other than Cassim the King of Thieves himself.
- In the original 1,001 Arabian Nights, Ali Baba was a poor woodcutter and the brother of a wealthy man named Cassim who discovered the secret hideout of the Forty Thieves and their vast treasure after overhearing the magic word necessary to open the way to their hideout "Open Sesame". When he discovered the hideout, Ali Baba was betrayed by his brother Cassim who wanted the treasure for himself but ended up being killed by the Forty Thieves for his greed. With his evil brother slain, Ali Baba obtained the treasure and became very wealthy but the Forty Thieves plotted to get their revenge on Ali Baba. Luckily Ali Baba was saved time and again by his brother's clever former slave Morgiana who was now in the service of Ali Baba and in the end she was able to slay the Forty Thieves and their leader and as thanks Ali Baba offered Morgiana his son's hand in marriage to which she happily accepted.
- Due to the many differences between Aladdin and the Arabian Nights, it is unknown how much of this is still part of Ali Baba's history in the setting of Aladdin or if Aladdin's father Cassim is meant to be a more benevolent version of Ali Baba's brother or a completely different Cassim.
- In the first film, Aladdin adopts the alias of Prince "Ali Ababwa", an obvious anagram of Ali Baba, fitting considering his role in Aladdin and the King of Thieves is somewhat similar to Ali Baba's.