It's long been understood that sexuality exists on a range from exclusively straight to exclusively gay, and the distribution is probably like a "bell curve" -- with most folks somewhere in the middle. It's also been understood that people's curiosities are not static and that while someone may be more on the straight end of the distribution, they may have interests from time to time that are elsewhere on the spectrum.
All of this is to say: people may identify one way, but they may have occasional interests and inclinations, and those activities do not necessarily change how they identify over the long term. Sexuality and sexual desire is fluid, and the minute you try to pigeon-hole anyone, they will defy that... and that's not because they're doing anything wrong -- it's that your attempt to define them statically as one thing or another is ill-conceived and always going to be trying to pin down a moving target.
As one commentator said: there's a difference between how you identify yourself in your own mind, how you act in view of others, and what actually goes on in your head when you're jerking off. The more closely aligned those three things are, the more sexually fulfilled you may be. But some people are not aligned on those three things and the more divergent, the more conflicted their lives will be.