Dogs snap at flies because they're playing and because it twigs their prey-chase instincts.
They don't automatically know a bee from a fly.
Some Dogs who snap up a bee and get stung stop doing it, but others just can't resist.
I knew a dog who would eat large wasps out of the air.