First, this answer assumes you trade in your Pokemon as soon as you have access to trading. The Pokemon arrive at level 5, and their only moves are level up moves that they can learn at or before level 5.
In BW, Bagon has no physical STAB until it either evolves at level 50 and gains STAB for fly, or you get the TM for dragon claw at Victory Road. Larvitar learns rock slide at level 19 and the TM for dig is on Route 4, so Larvitar is almost certainly better for BW.
source
source
Things are different in HGSS because you can get a TM for dragon claw before the third gym. Pupitar's far better offensive typing and far worse defensive typing gives it more good matchups and bad matchups, while Shelgon's higher physical attack gives it an advantage in neutral matchups. This is how well they'd do in each boss battle before the Hall of Fame.
Li: Larvitar resists his highest level Pokemon's attacks.
Falkner: Larvitar resists all of his attacks and likely has rock slide by this point.
Bugsy: All of his Pokemon are weak to rock.
Whitney: Larvitar resists all of her attacks.
Rival (Burned Tower): Larvitar has the type advantage against 2 of his lower level Pokemon. Bagon is better only if he has Bayleef.
Morty: Both have super effective coverage moves. I'd say Larvitar is better because payback is stronger than shadow claw when moving second.
Eusine: Larvitar has type advantage against his highest level Pokemon.
Chuck: Pupitar is weak to both of his highest level Pokemon's STABs, so Shelgon is obviously better.
Pryce: Both have low special defense and are weak to ice.
Jasmine: Her Pokemon resist all of Shelgon's physical coverage (dragon claw, shadow claw, and zen headbutt) and are weak to Pupitar's dig.
Archer: Pupitar resists more of his attacks, and its dig is super effective against 2 of his Pokemon.
Clair: Both have low special defense and are weak to several of her moves.
Will: Mostly type neutral matchup for both, so Shelgon does slightly more damage here.
Koga: Pupitar resists many of moves, and its STAB moves are super effective against most of his Pokemon.
Bruno: Shelgon has zen headbutt, while Pupitar is weak to fighting.
Karen: Pupitar has the advantage against her highest level Pokemon.
Lance: 5 of his Pokemon have a dragon attack, while only 2 have a water or ice attack, which makes Pupitar better.
So Pupitar is better than Shelgon in more than half of these battles. Note that because both of them evolve late and have bad stats until then, both are still worse than a lot of other choices like HGSS Geodude and BW Drillbur.