He was born in Edinburgh the son of Alexander Stewart, a painter and decorator, and his wife, Agnes Grainger. The family lived at 88 Princes Street facing Edinburgh Castle. He was educated at the High School in Edinburgh He was then accepted at the University of Edinburgh Medical School, graduating MD in 1858, and studied further as a postgraduate in Berlin, Prague and Vienna. On his return to Edinburgh he became resident physician in the Royal Infirmary. In 1862 he was appointed pathologist to the Royal Infirmary and lecturer on pathology at Surgeon's Hall. During the following seven years he published numerous papers on pathological and clinical subjects, and in 1869 unsuccessfully contested the chair of general pathology at the University of Edinburgh. In 1866 he was elected a Fellow of the Royal Society of Edinburgh his proposer being John Hutton Balfour. At this time he was living with his family at 32 Queen Street, a fashionable Georgian townhouse. He resigned his post as pathologist, and was in early 1876 elected ordinary physician to the Royal Infirmary and lecturer on clinical medicine. On the death of Dr. Thomas Laycock later the same year, Grainger Stewart succeeded him as Professor of Medicine at the University of Edinburgh, serving as such until his own death in 1900. He wrote several prominent medical works, notably on kidney, lung and nervous diseases, and the popular textbook On the position and prospects of therapeutics: a lecture introductory to a course on materia medica and dietetic. Grainger Stewart was president of the tenth International Medical Congress in Berlin, and in 1898 was president of the British Medical Association at its meeting in Edinburgh. From 1889 to 1891 he was president of the Royal College of Physicians of Edinburgh. In 1882 he was appointed a Physician-in-Ordinary to Queen Victoria for Scotland, and in 1894 received a knighthood on the recommendation of the Prime Minister, Lord Rosebery. He received the honorary degreeLegum Doctor from Aberdeen University in 1897. He was also a literary critic, playwright, and amateur archaeologist, an elder of the Free Church and in politics a Liberal. In later life Stewart lived at 19 Charlotte Square, one of Edinburgh's most prestigious addresses, just off Princes Street. He died at his residence in Edinburgh on 3 February 1900, and is buried in an east-facing grave in one of the smaller south sections in Dean Cemetery in Edinburgh. The grave is marked by a modest curved stone.
Family
He married twice: first in 1863 to Josephine Dubois Anderson, who died the following year; second, in 1866, to Jessy Dingwall Fordyce MacDonald. Both wives are buried with him. His daughter, Agnes Grainger Stewart, was a writer.