It does not — Raichu cannot learn Thunder Punch by levelling up in the mainline games. You have to find someone who will teach it.
In practice that means the move tutor, an NPC who charges a currency or a shard for the lesson rather than granting it automatically at a set level. Which tutor is available depends entirely on the generation you are playing, so check the move tutor list for your specific game rather than assuming consistency across titles.
Breeding is the other route: a Raichu hatched from an egg whose other parent knew the move will start with it.