My Illogical Theory
I think it's a reference to Ash in the anime.
Think - Ash always wears a hat in the anime, and it's like his prized possession for goodness sake, and people know him well because of that famous item of clothing. He's rarely ever seen without it. I think Game Freak wants some sort of 'feel' of this famous item of clothing in the games, so the player feels more like Ash.
To reference to why the rivals don't wear hats, that is solely because every rival has been seen in the anime, and most anime characters (to my information) don't really wear hats. The protagonists aren't really in the anime (unless you exclude Dawn, who doesn't really wear a real 'hat', and Red who kind of resembles Ash, but not fully), and they wear hats as an over world sprites. Also notice that most of the boy characters wear their hats backwards when in battle, like Ash does.
So, that is my theory.
Hope I helped. :)