Have an axe to grind
Have a dispute to take up with someone or, to have an ulterior motive/ to have private ends to serve.
Ax or axe? The spelling more commonly used in America is ax and, in Britain, axe, although in neither nation is there consistency. The phrase, in its having private ends to serve meaning, is commonly attributed to Benjamin Franklin. Other opinions point to another author who, like Franklin, lived in Pennsylvania, USA - Charles Miner. It is difficult to trace the origin, as both men wrote and printed cautionary metaphorical tales concerning the sharpening of axes.
Franklin sent a story called 'The Whistle' to a friend in 1779. This concerns a child who paid more than he should have for a whistle and later regretted his lack of caution. Franklin's autobiography, which was written between 1771 and his death in 1790 and first published in 1791, also contains an anecdote concerning a man who asked a smith to sharpen his ax especially well and ended up doing the work of turning the grindstone himself. Neither story mentions the phrase an ax to grind.
Miner appears to have written a text called Who'll turn Grindstones?, which does explicitly mention an axe to grind, but which is similar enough to Franklin's earlier stories for some to suggest that Franklin was the real originator of the phrase. I say appears to have written as the first publication of Miner's story is an anonymous piece in the Pennsylvania newspaper The Centinel, on 28th November 1810, under the title Who'll turn Grindstone? This is listed as being reprinted from the Luzerne Federalist. Miner was co-founder of the Federalist, so it's reasonable to assume that he was author. The story is a cautionary fable concerning the author's recounting of an incident from his youth, where a passing stranger takes advantage of him and, by flattering him, dupes him into turning a grindstone to sharpen the stranger's axe. Miner then uses having an axe to grind as a metaphor for having an ulterior motive:
"When I see a man holding a fat office, sounding 'the horn on the borders' to call the people to support the man on whom he depends for his office. Well, thinks I, no wonder the man is zealous in the cause, he evidently has an axe to grind."
The story is published again in 1812; this time under Charles Miner's name and with a slightly different text:
"When I see a merchant over-polite to his customers ... thinks I, that man has an axe to grind."
So, whether or not we view Miner as cribbing his work from Franklin, it seems that it was he who first put the phrase into print.
The meaning that is usually given to the phrase in Britain is having a dispute to take up or point of view to express. Again, it isn't easy to trace the source of this usage. It may be that it migrated from the USA. The sense of having an agenda is common to both versions of the meaning and it doesn't seem likely that the two versions of the phrase arose independently.
James Joyce used the phrase in Ulysses, apparently with that 'British' meaning although, as ever with that particular work, rather difficult to interpret:
Skin-the-Goat, assuming he was he, evidently with an axe to grind, was airing his grievances in a forcible-feeble philippic anent the natural resources of Ireland or something of that sort...
See other phrases that were coined in the USA.