Muir was born in Glasgow, the son of William Muir (1783–1820), a merchant of Kilmarnock and magistrate of Glasgow, and Helen Macfie (1784–1866). He was the elder brother of the Indian administrator and principal of the University of Edinburgh, Sir William Muir.
He was educated at Irvine Grammar School in Ayrshire, then studied in the University of Glasgow, and the East India Company College near Hertford. He arrived in India with the East India Company in 1829 as a civil servant, working first in Bengal, and served in various offices, as assistant secretary to the board of revenue, Allahabad, as collector at Azamgarh and as civil and session judge at Fatehpur. In 1844, he was appointed to be the first principal of Victoria College, Benaras, that later evolved into the Sampurnanand Sanskrit University. From 1842 to 1853 he was a Session Judge in the court at Futtehpore. During this period he was awarded an honorary doctorate in civil law (DCL) by the University of Oxford a second honorary doctorate (LLD) from the University of Edinburgh and a third from the University of Bonn (PhD).
In 1862 he endowed the chair of Sanskrit in the University of Edinburgh, and was the main agent in founding the Shaw fellowship in moral philosophy. He was a DCL of Oxford, LLD of Edinburgh and PhD of Bonn, and was one of the first to receive the distinction of Companion of the Indian Empire.
Muir died unmarried, on 7 March 1882, at 10 Merchiston Avenue, Edinburgh.
He is buried in the Grange Cemetery against the western wall of the original cemetery, adjacent to the entrance to the 20th century extension.
Muir's main work is Original Sanskrit texts on the origin and history of the people of India, their religion and institutions (1852–1870), a study of the most important source texts of Indian cultural and religious history, with English language translation. In 1858 the first volume of his Original Sanskrit Texts (2nd ed., 1868) was published; it was on the origin of caste, an inquiry intended to show that it did not exist in the Vedic age. The second volume (1st ed., 1860; 2nd, 1871) was concerned with the origin and racial affinities of the Hindus, exhibiting all the then available evidences of their connection, their linguistic, social and political kinship, with the other branches of the Indo-European stock. The third volume (1st ed., 1861; 2nd, 1868) was on the Vedas, a full inquiry as to the ideas of their origin, authority and inspiration held both by the Vedic and later Indian writers. Volume four (1st ed., 1863; 2nd, 1873) was a comparison of the Vedic with the later representations of the principal Indian deities, an exhibition of the process by which three gods hardly known to the Vedic hymns became the deities of the former Hindu Trimurti. The fifth and final volume was published in 1870 and was on the Vedic mythology. Muir was also the author of a volume of metrical translations from the Sanskrit, an anonymous work on inspiration, several works in Sanskrit, and many essays in the Journal of the Royal Asiatic Society and elsewhere.
In 1839, Muir published Matapariksa: Sketch of the Argument for Christianity and against Hinduism, a work that, in contrast to the vitriolic missionary tracts prevalent at that time, presented Hinduism in empathetic tone and depicted Christianity and Hinduism as more or less compatible, although Christianity was clearly depicted as superior. However while sensitive to "Hindu genius" Muir advanced miracles, moral excellence, and universality as three basic arguments in favour of Christianity. The work was controversial in India and helped launch a counter-apologetic movement among Hindu scholars.
- Muir, John (1861). "Original Sanskrit Texts on the Origin and Progress of the Religion and Institutions of India". Williams and Norgate. Cite journal requires
- Powell, Avril A. (23 September 2004). "Muir, John (1810–1882), Sanskritist". Oxford Dictionary of National Biography. 1 (online ed.). Oxford University Press. doi:10.1093/ref:odnb/19497. (Subscription or UK public library membership required.)
- History of Sampurnanand Sanskrit University
- Biographical Index of Former Fellows of the Royal Society of Edinburgh 1783–2002 (PDF). The Royal Society of Edinburgh. July 2006. ISBN 0-902-198-84-X.
- Bendall 1894.
- Bendall, Cecil (1894). Lee, Sidney (ed.). Dictionary of National Biography. 39. London: Smith, Elder & Co. . In
- Podgorski, Frank R.; Young, Richard Fox (October 1983). "review of 'Resistant Hinduism: Sanskrit Sources on Anti-Christian Apologetics in Early Nineteenth-Century India' by Richard Fox Young". Philosophy East and West. Philosophy East and West, Vol. 33, No. 4. 33 (4): 417–418. doi:10.2307/1398604. JSTOR 1398604.
- public domain: Chisholm, Hugh, ed. (1911). "Muir, John". Encyclopædia Britannica (11th ed.). Cambridge University Press. This article incorporates text from a publication now in the
- This article incorporates text from a publication now in the public domain: Bendall, Cecil (1894). "Muir, John". In Lee, Sidney (ed.). Dictionary of National Biography. 39. London: Smith, Elder & Co.
- Avril A. Powell (2010). Scottish orientalists and India: the Muir brothers, religion, education and empire. Boydell & Brewer. ISBN 978-1-84383-579-0.