The site of Khan el-Khalili actually was a mausoleum back to the Fatimid caliphs known as the turbat az-za’faraan (Saffron Tomb). Cairo was conquered and founded by Gawhar al-Siqilli in 970 AD, who established the Fatimid Great Eastern Palace complex in this region and the mausoleum was part of it.
By the time of Sultan Barquq, the first Circassian Mamluk Sultan in the late 14th century, the black death spread across Egypt but this great country continued to be the center of the economic activity, and many commercial and religious constructions were erected during this period, but the credit for building Khan el-Khalili goes to the Amir (prince) Jaharkas al-Khalili, Barquq’s master of the Stables, who erected a large serai or souk at the heart of the city ; a place where the merchants can live and store their goods, but unfortunately he demolished the Fatimid cemetery to build this souk, discarding the Fatimid’s bones into an rubbish hills.
Later on sultans also built commercial establishments nearby, including Sultan Qaytbay’s wikala (another term for caravanserai) south of the Al-Azhar Mosque, and Sultan al-Ghuri’s better-preserved wikala just east of his mausoleum complex.
This zone runs along the city’s main north-south axis, al-Mu’izz street, and is full of monumental religious complexes built throughout the Mamluk period and beyond.