Well, it could be from stress. Maybe he's got a lot going on at school, like exams or dealing with bullies. That would be a common cause in fanfiction.
It could also be due to a magical or supernatural cause. In some fanfictions, there are elements of magic or the paranormal. Maybe he was cursed by a wizard or affected by some sort of strange energy that's causing his head to hurt. This would open up a whole new avenue for the story to explore, like him having to find a way to break the curse.