Born in Edinburgh, he was the only son of Roger Aytoun, a writer to the signet, and was related to Sir Robert Aytoun. To his mother, a woman of marked originality of character and culture, he owed his early tastes in literature, his political sympathies, his love for ballad poetry, and his admiration for the House of Stuart. At the age of eleven he was sent to the Edinburgh Academy, and from there to the University of Edinburgh.
In 1833 he spent a few months in London studying law, but in September of that year he went to study German at Aschaffenburg, where he remained until April 1834. He then resumed his legal studies in his father's chambers, was admitted a writer to the signet in 1835, and five years later was called to the Scottish bar. By his own confession, though he followed the law, he never could overtake it. His first publication, a volume entitled Poland, Homer, and other Poems, in which be gave expression to his eager interest in the state of Poland, had appeared in 1832.
While in Germany he made a translation in blank verse of the first part of Faust; but, forestalled by other translations, it was never published. In 1836 he made his earliest contributions to Blackwood's Magazine, in translations from Uhland, and from 1839 until his death he remained on the staff of Blackwood's. In it appeared most of his humorous prose pieces, such as The Glenmutchkin Railway, How I Became a Yeoman, and How I Stood for the Dreepdaily Burghs, all full of vigorous fun. In the same pages began to appear his chief poetical work, the Lays of the Scottish Cavaliers, and a novel, partly autobiographical, Norman Sinclair. In about 1841 he became acquainted with Theodore Martin, and in association with him wrote a series of humorous articles on the tastes and follies of the day, in which were interspersed the verses which afterwards became popular as the Ben Gaultier Ballads (1855). Another work was Firmilian, a Spasmodic Tragedy, under the nom-de-plume of T. Percy Jones, intended to satirise a group of poets and critics, including Gilfillan, Dobell, Bailey, and Alexander Smith.
His reputation as a poet chiefly rests on Lays of the Scottish Cavaliers (1848). In 1845 he was appointed professor of rhetoric and belles lettres at the University of Edinburgh. His lectures attracted large numbers of students, raising the attendance from 30 to 150. His services in support of the Tory party, especially during the Anti-Corn-Law struggle, received official recognition with his appointment (1852) as sheriff of Orkney and Zetland.
He was married to a daughter of Professor Wilson (Christopher North).