When it doesn't need to attack or its offensive stats will just tickle the enemy. This means that it is usually dedicated support Pokemon. The most perfect example is Blissey. As far as I know since its existence, it never ran a normal type stab move and usually went with seismic toss. Even now in gen eight it runs shadow ball over anything else. Another good example was a Skarmory variant in gen six with spikes, roost, defog and whirlwind so it has flexibility on how it wants to annoy the enemy. Some more example is Garchomp and Hydreigon in current gen eight. It's not always but sometimes, sd Garchomp goes rocks edgequake or edgequake fire blast while Hydreigon usually goes support with defog roost epower and dark pulse
All in all, when a Pokemon's job is not to attack, has a specific target, has a colorful movepool or is a dragon type, then it can afford to skip its stab. Your Porygon example is one I assume to hit dog Zygarde since Porygon is so bulky. As for the dragon type, dragon claw and outrage are no longer as good. Dclaw would sometimes fall short while outrage is a death sentence so most physical dragon types sometimes skip one of its stabs