If you have an axe to grind, it means you are holding a grudge or want to pursue a particular agenda (e.g., “Everyone could see that John had come to the meeting with an axe to grind”).
Having an axe to grind is an example of an idiom, where the meaning of the phrase is not what it says literally.
You can imagine that in a situation where there is a line of people waiting to use a public grind wheel, someone who is waiting to grind their axe will be a little impatient and focused on getting the job done. This is having an axe to grind.
In American English, axe and ax are interchangeable, so you may see the expression spelled as ax to grind.