Origin
It can have one of several connotations, all related in some capacity to the title of Khan, which originated from the Mongol Empire and its subjects and was thereafter historically granted to Muslim rulers. Infiltration of the name from Central Asia into South Asia happened with the coming of the various Muslim Turks, Afghans, and Mughals into South Asia who used this name as a title as well as a suffix to indicate their ethnic identity.
Communities using Khan as a surname
The communities that use the surname Khan include the Afghans, Turkic peoples in Central Asia and Northern Pakistan; tribes in Pakistan and their purported descendents in India and Bangladesh, Baloch tribes in Balochistan and in Sindh and various Mongol, Turks and Tatar tribes in central and northern Asia.
As a title
As a title, Khan has historically been used mainly by the Mongols and Turkic rulers and chieftains. It has also been adopted by Pashtuns in the former Afghan territories of the current North West Frontier Province of Pakistan where the division of regions into Khanates has exited from early Muslim period e.g. the various Khanates in Swat, Hazara and Peshawar districts.
Khan is mainly used by the Pushtuns and in the South Asain Subcontinent a Pashtun is addressed as Khan Sahib routinely whether he has Khan formally as part of his name or not. Moreover, the term Khawanain is used to refer to the Khans, collectively, as rulers, chiefs etc. of Khanates in the North West Frontier Province of India, and later Pakistan, particularly in Hazara, Swat, Dir, Mardan and other districs in contemporary Khyber Pakhtunkhwa. In the non-Frontier regions of the Subcontinent Khanates did not exist at anytime in history.
The British Raj continued the Mughal practice of awarding titles such as Khan Bahadur for Muslims and Rai Bahadur for Hindus.