Hey!
This is biology. Man is made to put our DNA in history and with as many women as we can.
This can't be re-wired as this was set in our brains by our naked ancestors.
But we can understand this.
My advice would be, don't masturbate (at least alone). Save this energy for Your girlfriend.
Also, fantasising is ok, but if this increase in frequency, then borders get thin and You might get tempted to "act" on it.
Other advice would be, try something new with Your girlfriend. I mean in bed.
Man can get bored of seeing the same stuff again and again. Again, this is how biology works.
Good luck!
Best regards,
W.A.M.
P.S. Don't tell her You are fantasizing about others, especially during sex. This will be a big blow and she probably will get self conscious. From there it will get only worse.