Pain is something that in Polish usually kinda 'happens to you'. Your ear hurts to you. Your stomach hurts to you. I think a construction "jej ucho boli" (her ear hurts) is also possible but less common. I am a lot more likely to say "Boli mnie głowa" than "Moja głowa boli".
So in this more common option that is used here, the pronoun is in Accusative. Boli kogo? co? Głowa boli Jacka. Brzuch boli kota. (this is of course weird word order, because it's 'whom does the head hurt'?, but I'm just trying to explain the 'why'.)
Ah, ok, thanks. I don't think we've seen much/any "ją" in the course so far, but that makes sense. Spanish is kind of the same way - me duele la cabeza - (my) head hurts me. Though that might actually be dative(?) - I'm not great at mapping cases to less-declined languages.