Ainslie was the eldest son of Sir Philip Ainslie, and was born near Edinburgh in 1776. He entered the army as ensign in the 19th Regiment in 1793, and having political influence through his mother, a daughter of Lord Grey, was in the same year promoted lieutenant, and in the next captain in the 85th Regiment. With his regiment he saw service in Flanders, and in 1799, when he was promoted major, was engaged in the short and disgraceful Anglo-Russian invasion of Holland. He seems to have shown no particular capacity as a soldier or much ardour for a military life, and so was in 1800 promoted to a lieutenant-colonelcy in a Fencible Regiment.
Colonial governor
In 1802 he married a Miss Nevile, but did not again try for employment in his profession. He was, however, made lieutenant-colonel of the 25th Regiment in 1807, and promoted colonel by brevet in 1810. His influential relatives now obtained him a colonial governorship, that of the island of St. Eustatius in 1812. Two months later he became Lieutenant-Governor of Grenada where he had confrontations with the free people of colour over their rights as free citizens. In early 1813 he was appointed as Governor of Dominica where he issued a proclamation to find and exterminate the Maroon population in May. By July he found he was dealing with the impacts and losses from a devastating hurricane, coupled with increasing unrest on the plantations. He took a martial approach and in October 1813 declared 'I do further declare, that the utmost rigour of military execution shall be put in force against all those runaway slaves that may be apprehended after that period, neither age nor sex spared, all indiscriminately shall be put to the bayonet'. The severity of these measures attracted the attention of the Secretary of State for the Colonies and he was summoned to the UK in June 1814, although did not return until November. in the end some 577 slaves and maroons were involved, with 18 killed during capture, 16 dying in jail and a further 5 executed. Despite the protests to Parliament of landowners and members of the Dominica Assembly he was censured for his actions and demoted. Ainslie's undistinguished military and colonial governorship forced him to accept a lower post in 1816, that being lieutenant-governor of Cape Breton Island. He arrived there in to find a colony in chaos because of lack of funds and uncollected taxes. Ainslie contributed to the situation by assuming a managerial stance similar to the one that had earned him this demotion. Basically the colony felt the taxes were illegal because of the lack of, and subsequent approval by, an assembly council. Ainslie's inability to deal with the crisis effectively destroyed the colony and it was re-absorbed into Nova Scotia on 16 October 1820. On that day Lieutenant-Governor Sir James Kempt of Nova Scotia officially proclaimed the end of Cape Breton as a separate colony.
Coin collector
Major-General Ainslie, for he had been promoted previous to his recall, was now free from any active employment. Nature had designed him for a savant, not a soldier. His hobby was collecting coins. The taste for coin-collecting had much decreased in England since the days of Addison, and he found a clear field for his labours. He made a specialty of Anglo-Norman coins, and travelled all over England, and, what was then a more uncommon thing, all over the rural districts of Normandy and Brittany, in search of coins. He published in 1830 the result of his labours in a magnificent quarto entitled Anglo-French Coinage, adorned with many illustrations. By his industry he had got together almost a unique collection of rare coins, and, absorbed in the pursuit, died peacefully in 1839.
Legacy
Lake Ainslie and Ainslie Point on Cape Breton Island is named for him.