Ali Baba is a character in the tale of Ali Baba and the Forty Thieves.
To save her life, Scheherazade's told the story of Ali Baba and the Forty Thieves for Shahryār. She started telling Shahryār that Ali Baba and his brother were the sons of a merchant who traded in camels and spices, before Shahryār interrupted her, and revealed that he intends to behead her if the story doesn't get better. cheherazade continued to read her story by telling him that when Baba was out for a walk he was set upon by a thief. Shahryār was not happy so she changed it to two, then a million thieves, but Shahryār told her that it was too many so she changed it to forty thieves and continued to tell her story.