Men flirt with other women because the male is a highly visual being. They stare at a woman or flirt with her and don't even realize they are doing it. It is hard wired into their brain to behave this way. Most flirting is harmless and he just does it subconsciously. They get a kick out of having a woman flirt back.
Hence if a man is less than FULLY loved, he feels like a boat without anchor floating and drifting in the ocean. Love is a need, Love is "food" for the soul. Love is real, a real energy that can be seen and felt. If a man gets less than ALL love from his "girlfriend" then he actually has NO real girlfriend and looks for someone giving him all the love he is hungry for.
If you give all you can and could and accept all love you get offered at all times, then you never experience a flirting partner at all!
I'm pretty sure that gals and guys both flirt. It really just depends on the person. It's one thing to be committed to someone, but it is quite another to cut off communication with the opposite sex. Innocent flirtation here and there is not a big deal. But, if I read your question correctly, you are asking why a guy will flirt in front of his girlfriend with other women... And, to that I say, the guy is rude and disrespectful, especially if he knows that it makes his girlfriend uncomfortable.