His father was George Hamilton, younger brother of James Hamilton, 2nd Earl of Abercorn, and putative 6th duke of Châtellerault in the peerage of France; and his mother was Mary Butler, sister of James Butler, 1st Duke of Ormonde. According to some authorities he was born at Drogheda, but according to the London edition of his works in 1811 his birthplace was Roscrea, Tipperary.
From the age of four until he was fourteen the boy was brought up in France, where his family had fled after the execution of Charles I. The fact that, like his father, he was a Roman Catholic, prevented his receiving the political promotion he might otherwise have expected on the Restoration of the monarchy in 1660.`
Anthony Hamilton joined his brother George in exile in France in 1667, after George had refused to take the oath of supremacy. He served in the French army, particularly in the Franco-Dutch War, in a regiment recruited by George in Ireland. The marriage of his sister Elizabeth, "la belle Hamilton", to Philibert, comte de Gramont committed him more closely to France.
Hamilton appeared in a performance of Philippe Quinault's ballet, the Triomphe de l'Amour, at Saint-Germain-en-Laye in 1681. In 1685, on the accession of James II to the British throne, Hamilton was one of a small group of Catholic professional soldiers brought in to replace Protestants purged from the officer corps of the British army in Ireland. Others were his brother Richard, who broke parole to do so; Patrick Sarsfield; and Justin McCarthy.
Hamilton was appointed governor of Limerick to succeed Sir William King, and arrived on 1 August. Shortly he demonstrated his Catholicism when he went publicly to mass. He was at this time lieutenant-colonel of Sir Thomas Newcomen's regiment, but was advanced, on the recommendation of Henry Hyde, 2nd Earl of Clarendon, to the command of a regiment of dragoons and sworn of the privy council in 1686. With the rank of major-general he commanded the dragoons, under Justin McCarthy, Viscount Mountcashel, at the siege of Enniskillen. In the battle of Newtownbutler on 31 July 1689, serving under MacCarthy, Hamilton was wounded in the leg at the beginning of the action, and his raw levies were routed with great slaughter. Hamilton succeeded in making good his escape. Hamilton was considered to have led his dragoons into an ambush by over-confidence; and to have made minimal efforts to extricate them. With Captain Lavallin from Cork he served as scapegoat for the defeat, being subjected to a court martial under General von Rosen. Given his influence Hamilton was acquitted, while the hapless Lavallin was shot; but the reputations of the Hamilton brothers had suffered terminal damage with the French.
Hamilton fought at the battle of the Boyne, 1 July 1690. He does not appear to have been present at the battle of Aughrim.
It is not clear when or how he obtained his title of count. The rest of his life appears to have been spent chiefly at the court of St. Germain-en-Laye, with visits to the châteaux of his friends. With Ludovise, duchesse du Maine, he became an especial favourite, and it was at her seat at Sceaux that he wrote the Mémoires that made him famous. He died at St Germain-en-Laye.
The Mémoires du comte de Gramont made Hamilton one of the classical writers of France. The tone of the work, however, is now thought equivocal. By highlighting the brilliance of the London Restoration court, it threw into relief the nature of the exiled Stuart court which contrasted so strongly with that of Charles II. It has even been said to share something with the polemic written against the court of James II at St Germain by John Macky.
The work was said to have been written at Gramont's dictation, but Hamilton's share is obvious. Written between 1704 and 1710, the work was first published anonymously in 1713 (apparently without Hamilton's knowledge) under the rubric of Cologne, but it was really printed in the Netherlands. An English translation by Abel Boyer appeared in 1714; over 30 further editions then appeared.
In imitation and satiric parody of the romantic tales which Antoine Galland's translation of The Thousand and One Nights had brought into favour in France, Hamilton wrote, partly for the amusement of Henrietta Bulkley, sister of Anne, Duchess of Berwick, to whom he was much attached, four ironic and extravagant contes, Le Bélier, Fleur d'Epine, Zénéyde and Les quatre Facardins. The saying in Le Belier, "Belier, mon ami, tu me ferais plaisir si tu voulais commencer par le commencement," passed into a proverb. These tales were circulated privately during Hamilton's lifetime, and the first three appeared in Paris in 1730, ten years after the death of the author; a collection of his Œuvres diverses in 1731 contained the unfinished Zénéyde. An 1849 omnibus entitled Fairy Tales and Romances contained English translations of all his fiction.
Hamilton was also the author of some songs, and interchanged amusing verses with the Duke of Berwick. In the name of his niece, the countess of Stafford, Hamilton maintained a witty correspondence with Lady Mary Wortley Montagu.