According to Bichitra Natak, said to be the autobiography of the last Sikh Guru, Gobind Singh, the Bedi sub-caste of the Khatris derives its lineage from Kush, the son of Rama (according to Hindu epic Ramayana). The descendants of Kush, according to the disputed Bachitar Natak legend, learned the Vedas at Benares, and were thus called Bedis (Vedis). Similarly, according to the same legend, the Sodhi sub-caste claims descent from Lav, the other son of Rama.
According to Ancient Greek sources, "The people that held the territory comprised between the Hydrastes (Ravi) and the Hyphasis (Beas) were the Khatriaioi, whose capital was Sangala". Sangala find mention in Mahabharata and Pali Buddhist texts as the capital of Madra Kingdom. J. W. McCrindle, the translator and writer adds that the name is found in the modern era, spread across a vast region in the northwest of India, from Hindukush to Bengal and from Nepal to Gujarat, in slightly variant forms, including the term Khatris and others.
Having gained the patronage of the Mughal nobles, the Khatris then adopted administrative and military roles outside the Punjab region. According to a Khatri legend of the 19th century, they continued their military service until the time of the Mughal emperor Aurangzeb, when the death of many of their number during the emperor's Deccan Campaign caused him to order their widows to be remarried. The order was made out of sympathy for the widows but when the Khatri community leaders refused to obey it, Aurangzeb terminated their military service and said that they should be shopkeepers and brokers. This legend is probably fanciful: John McLane notes that a more likely explanation for their revised position was that a Sikh rebellion against the Mughals in the early 1700s severely compromised the Khatri's ability to trade and forced them to take sides. Those who were primarily dependent on the Mughals went to significant lengths to assert that allegiance in the face of accusations that they were in fact favouring the rebel Jat Sikhs, led by Banda. The outcome of their assertions - which included providing financial support to the Mughals and shaving their beards - was that the Khatris became still more important to the Mughal rulers as administrators at various levels, in particular because of their skills in financial management and their historic connections with bankers.
Author Suresh Kumar described Khatris as silk weavers. Author Purnima Dhawan described that together with Jat community, the Khatris gained considerably from the expansion of the Mughal empire, although both groups supported Guru Hargobind in his campaign for Sikh self-government in the Punjab plains. The khatris played an important role in India's trans-regional trade during the period, being described by Scott Cameron Levi as among the "most important merchant communities of early modern India."
According to Hardip Singh Syan, the Khatris considered themselves to be of pure Vedic descent and thus superior to the Rajputs who, like them, claim the Kshatriya status of the Hindu varna system. However, these claims are disputed by most of the scholars who consider castes in north India, like Khatri and Kayastha to be merchant castes who claim higher status to befit the educational and economic progress they made in the past. According to Anand Yang, the Khatris are one of the sub-category of the Bania caste of north India along with numerous groups which are together categorised as Vaishya in the Varna system.
Khatri's standards of literacy and caste status were such during the early years of Sikhism that, according to W. H. McLeod, they dominated it. Author McLeod mentions the employment of khatris as soldiers by Mughal emperors but notes by the time of British arrival in India they were mostly merchants and scribes Kenneth W. Jones says "the Khatris claimed with some justice and increasing insistence, the status of Rajputs, or Kshatriyas, a claim not granted by those above but illustrative of their ambiguous position on the great varna scale of class divisions". Purnima Dhavan sees the claim as originating from a conflation of the words khatri and kshatriya, which are phonetically similar. In the 19th-century British administrators failed to agree whether the Khatri claim of Kshatriya status should be accepted, since the overwhelming majority of them were engaged in Vaishya (mercantile) occupation rather than in Kshatriya (military) pursuits. Dasharatha Sharma described Khatris of Rajasthan as a mixed pratiloma caste of low ritual status but suggested that they could be a mixed caste born of Kshatriya fathers and Brahmin mothers.
Historian Vijaya Gupchup from the University of Mumbai states that in Maharashtra, Brahmins showed resentment in the attempt by the Khatris to elevate themselves from a ritually low status to Kshatriya by taking advantage of the British neutrality towards castes. She quotes a translation from a Marathi publication that gave a Brahminic opinion of this attempt:
"Everyone does what he wants, Sonars have become Brahmins , Treemungalacharya was insulted by throwing cowdung at him in Pune, but he has no shame and still calls himself a Brahmin. Similarly a Khatri or Koshti(weavers) who are included in Panchal at places other than Bombay, call themselves Kshatriya in Bombay and say their needles are the arrows and their thimbles are the sheaths. How surprising that those sonars and Khatris at the hands of whom even Shudras will not take water have become Brahmins and Kshatriyas. In short day by day higher castes are disappearing and lower castes are prospering."
The Khatris of Gujarat and Rajasthan are said to have tailoring skills like "Darji" (tailor) caste. In the case of those Khatris who avow Sikhism, their Kshatriya claim reflects the confusing, even seemingly contradictory, attitude towards the traditional Hindu caste system that is evident in Sikh texts such as the Guru Granth Sahib, which on the one hand renounces the Hindu caste paradigm and on the other seeks to portray the gurus as a group of warrior-defenders of their faith, just as with the Kshatriya varna.
The vast majority of Khatris are Hindu. Most Hindu Khatris migrated to India after partition and settled in urban areas across India. They were estimated to constitute 9% of the total population of Delhi in 2003.
All the ten Sikh Gurus were Khatris: Guru Nanak was a Bedi, Guru Angad was a Trehan, Guru Amar Das was a Bhalla, and the remainder were Sodhis. During the lifetime of the Gurus, most of their major supporters were Khatris. A list of these is provided by a contemporary of the Sikh Gurus, Bhai Gurdas, in his Varan Bhai Gurdas.[need quotation to verify] However, many of the more successful Khatri traders opposed the strictures of the Khalsa movement, introduced by Guru Gobind Singh to end the concept of caste in Sikhism by removing traditional rituals and identities.
D.L. Sheth, the former director of the , listed the Indian upper castes that constituted the middle class and were traditionally "urban and professional" immediately after Independence in 1947. This list included the Khatris from Punjab, Kashmiri Pandits, Nagar Brahmins and the South Indian Brahmins; Chitpawans and CKPs (Chandraseniya Kayastha Prabhus) from Maharashtra; Kayasthas from northern India; the Probasi and the Bhadralok Bengalis; the Parsis; and the upper crusts of the Muslim and Christian communities. According to P.K.Verma, "Education was a common thread that bound together with this pan Indian elite" and almost all the members of these communities could read and write English and were educated beyond school.