Shiny gym leader pokemon?

Is this a glitch or meant to happen? or is it a rare chance???

I’m pretty sure every Pokemon that appears has a chance to be shiny, so you’re just lucky! (Or unlucky… depending on how much you like shiny Heracross)

IIts from the second gym the gym leader xavier fight