As far as I can tell, there are three types of people playing MMOs (when it comes to this discussion):
1. People who see their character as a respresentation of themselves.
2. Peole who use their character to roleplay.
3. People who see their character as a tool to preform actions in the game.
(Ofcourse like always when you try to pigeonhole people, a lot of people will fall in more then one group and some in none at all

)
Player 1 is usually asking the question you ask, because they assume everyone else plays the same way and usually because they feel treatened by people who roll the opposite gender. (I'm not saying you are, actually I think you aren't. But in years of years playing RPGs this question keeps popping up in the forums I visit, usually as an angry post, and always by this type of player.) The only reasons they can think of for people to roll a character of the opposite gender is because either other players are out to trick them (presumably they see MMOs as some kind of dating service, and are shocked to find the hot nightelf they've been flirting with for weeks is a guy), or assume that the other player is a closet gay/transgender/crossdresser and is living out a secret fantasy in game.
However, the thruth is that player 2 and 3 are likely to happily roll character of the opposite gender for reasons that are far different from what player 1 assumes.
Player 2 wants to tell a story with his character. Like the author of a book, the player doesn't care whether that character is male or female. Just like J.K. Rowling wrote a whole series of books with a male main character, the RPer cares more about chosing the right vessel for telling an (interesting) story then whether or not a character is an actual representation of their real life self. (As a matter of fact they might steer away from chosing someone like themselves, they see it as much more fun playing someone very different.)
Player 3 sees his character as a tool to play the game. This means either they chose their race and gender based on stats (in some games gender can affect stats) or on animation and looks. They don't care about gender, unless (like others mentioned above me) a particular gender looks better, has better animations or looks good in certain gear.
They don't see their character as a representation of themselves, but as a means to an end (in this case using skills when they press a button).
This group is also likely to roll a toon of the opposite gender because of " If I'm staring at the backside of a toon for hours on end, why not make it an attractive one?" And why not? If you are going to look at a character for hundreds of hours, why not chose one you like to look at?
Ofcourse there is a group of men rolling female characters to hang out in Goldshire and flirt with male characters in the hope to get free handouts and gold and because they get some sort of kick out of it. But that group is a very small minority. (And some women do this too

)
Anyway, personally I tend to fall somewhere between group 1 and 2. I tend to roll characters that look like myself, and even though I do roleplay the characters never stray far from my own morals. If I can I will chose certain features (like brown hair and eyes) to make my character resemble me at least vaguely. I'm not comfortable roleplaying males, and if I do roll a male they never stay around for long, they always get deleted.
However, I'm very aware other people do not play this way, and so I'd never assume a player is the same gender as their character, has the same morals as the character (someone playing an evil nasty necromancer could be really nice and helpful IRL for example) or is some sort of enemy IRL because they play on a different side/faction.
So play what gender you like, only a small group of people are going to assume your character is the same gender as you anyway, and if they do it's their mistake not yours
