Pokémon learning moves outside of their type could be related to the Pokémon's design rather than their type.
Keep in mind, Bite wasn't always a Dark type. In the first generation Bite was a Normal-type and didn't become Dark in Gen-II+. (Which in the remakes of Red/Green it made my strategy of buying the Magikarp not crazy as Gyrados curb-stomped Misty's at level 20!). Any Pokémon can learn normal type moves, provided they have the proper appendages (Geodude can't learn Megakick, and so on...)
Often, Pokémon would learn moves that were outside of their type because of creature design, i.e., Gyrados (Water/Flying), Rattata (Normal), and Raticate (Normal) learning Bite because of having a jaw with fangs.
Let's circle back to Gyrados. It's type is Water/Flying, and it can learn a couple of moves outside of it's type such as Bite and Dragon Rage. The reason it has these moves is because it's designed to look like a dragon, and is based off of a Japanese legend where a carp jumps up a waterfall and becomes a dragon.
Zubats are another case where design comes before type designation. It's type is Poison/Flying, but it learns moves like Supersonic (Normal), Bite (Dark), Leech Life (Bug), Astonish (Ghost), and Haze (ice). This Pokémon is based off a vampire bat, which sucks the blood out of prey (Leech Life), uses echolocation to fly around (Supersonic), and flies at night and in caves which can surprise people (Astonish).
When it comes the actual design of Pokémon, a team of designers come up with ideas/designs and they get handed to a committee, and then added to the game with to keep some balance in the roster. While I don't see the details in this article on Gamasutra with Hironobu Yoshida, from the way he describes the process it goes
- Draft pokemon art, keeping it on a server so other artists can see it as well.
- Submit to committee, who critiques and selects the roster for the next game, sending back rejected with notes for improvement.
- Moves/types get assigned.
- ?????
- Added to Pokédex.
- Profit.
So all in all, it's not really explained in universe why a Pokémon learns a move outside of it's type. It's all a mix of game design/mechanic. Also I'm using the games as the primary canon as they came first, and are the driving force in any new canon in the other media (with yellow being the only exception)