My cousin has a weavile that knows it, and I thought it was a glitch, but why can he learn surf?
Well Weavile seem to be based of Cats and Weasels. Both can swim and weasels are excellent swimmers. In the anime and game, when surf is used as a field move, the Pokemon usually swims around whiles toying or carrying it's trainer to his/her destination. They don't only share traits with weasels but also with cats. My next statement would be that you don't often swim because they rather not if it isn't really necessary, just like cats But like JarJar said, the definite answer lies with GAME FREAK My source was from Bulbapedia but I will add the link later
A lot of Pokemon can learn Surf, regardless of being a water-type, like Aggron. But that's just how they made it.
I had a Weavile with Surf once, so it's absolutely not a glitch. xD
All I can really tell you is that Game freak wanted it to be that way, there is no way anybody but them can tell you, unless Game freak told that person.