I read Kubla Khan by Coleridge and am wondering if this city existed or if it was based of another city in China
As the story goes – and the myths surrounding the writing of this poem need to be taken with a great deal of salt – Coleridge wrote "Kubla Khan" after falling asleep while reading Samuel Purchas' Pilgrimage, a seventeenth century work (originally in four volumes, but now published in something like twenty) describing the world, its diversity, and its history. The exact line is on page 415 (of the third volume, I believe): "In Xanadu did Cublai Can [i.e., Kublai Khan] build a stately palace, encompassing sixteen miles of plain ground with a wall, wherein are fertile meadows, pleasant streams, delightful streams, and all sorts of beasts of chase and game, and in the middest there a sumptuous house of pleasure, which may be removed from place to place."
Simply put, yes, Shangdu, or Xanadu as it was transliterated, is a real place. I hope the mods, in their infinite mercy, will forgive a Wikipedia citation this time around, as I'm currently away from my more formal reference books.