Delhi has been continuously inhabited since the 6th century BCE. Through most of its history, Delhi has served as a capital of various kingdoms and empires. It has been captured, ransacked and rebuilt several times, particularly during the medieval period, and modern Delhi is a cluster of a number of cities spread across the metropolitan region.
There are a number of myths and legends associated with the origin of the name Delhi. One of them is derived from Dhillu or Dilu, a king who built a city at this location in 50 BCE and named it after himself. Another legend holds that the name of the city is based on the Hindi/Prakrit word dhili (loose) and that it was used by the Tomaras to refer to the city because the iron pillar of Delhi had a weak foundation and had to be moved. The coins in circulation in the region under the Tomaras were called dehliwal. According to the Bhavishya Purana, King Prithiviraja of Indraprastha built a new fort in the modern-day Purana Qila area for the convenience of all four castes in his kingdom. He ordered the construction of a gateway to the fort and later named the fort dehali. Some historians believe that Dhilli or Dhillika is the original name for the city while others believe the name could be a corruption of the Hindustani words dehleez or dehali—both terms meaning 'threshold' or 'gateway'—and symbolic of the city as a gateway to the Gangetic Plain.
The people of Delhi are referred to as Delhiites or Dilliwalas. The city is referenced in various idioms of the Northern Indo-Aryan languages. Examples include:
Abhi Dilli door hai (अभी दिल्ली दूर है) or its Persian version, Hanuz Dehli dur ast (هنوز دهلی دور است), literally meaning Delhi is still far away, which is generically said about a task or journey still far from completion.
Dilli dilwalon ka shehr or Dilli dilwalon ki meaning Delhi belongs to the large-hearted/daring.
Aas-paas barse, Dilli pani tarse, literally meaning it pours all around, while Delhi lies parched. An allusion to the sometimes semi-arid climate of Delhi, it idiomatically refers to situations of deprivation when one is surrounded by plenty.