According to early legends, the founding of the city dates back to ancient times when Noah's son Shem built a fortress in the desert.....
The Great Flood had well and truly dried up, leaving the Karakum (black sands) Desert in its wake. One evening Shem and his band of soldiers and relatives were making their way across its sands and had camped for the night.
The next morning Shem awoke from a vivid dream in which he had seen a thousand soldiers marching over the Karakum carrying torches. Interpreting this as a sign, he immediately ordered his men to begin digging a fortress. Fairly soon, the workers became thirsty and realised that their meagre supplies of water would quickly dry up. That night Shem had another dream in which the angel Gabriel told him to walk twenty paces south of the camp and begin digging.
As soon as it was light Shem and his men did just that, and after digging a deep hole, they struck water. When they lifted it to their lips and tasted its sweetness, they exclaimed 'Khey Vakh!' and with that, gave Khiva its name.
Today, the northern city wall stands where the camp was and twenty paces south, tucked away in a private cottage, is Shem's well. Just how much is fact and how much is fiction is anyone's guess, although it's interesting to note that the Bible recounts the descendents of Noah and includes Uz as Shem's grandson (Genesis ch11 v23).