It's hard to control your imagination. Our minds can't help wandering from time to time, and often at the most inconvenient moments.
Depending on how you see it, sex can be considered an inopportune moment. When it comes to imagining things during sex, people seem pretty divided. Fantasies are cool, as long as they aren't too violent or insane. Sometimes you keep these thoughts to yourself, and sometimes you share them with your partner.
But what about imagining you're banging someone else? Some people think it's a big no no, because it's insulting to your partner. People feel that it means you'd rather be doing it with someone else (which is sometimes the case). But some argue that it's hard to control your thoughts and fantasies, and they aren't hurting anyone.
Regardless of what side you're on, many of us have done it before, whether it was intentional or not. Just one piece of advice? Maybe don't tell your partner, 'cause not everyone likes the idea of you banging someone else, especially if the person you picture is an ex.