Well, as I said, speaking from a definitions standpoint, gender and sex are two different concepts.
Sex is what you -are- physically. Gender is what you -feel- you are, socially. The primary difference between them is that the former(Sex) is a physical trait, and the latter(Gender) is a social construct. For example, "typical female personality traits" are a part of one's gender, not one's sex.
The usual reason for transgender changes are due to a disconnect between one's gender and one's sex - and since people find changing their mind to be somewhat impossible or otherwise prefer to leave it be, in this case, the body - their physical sex - the more mutable of the two. The idea is that one feels trapped in one's own body, with parts and pieces that don't belong. The mental gender feels constrained by the physical sex, and there's a psychological desire to make the two match.
Whether or not it's a legitimate thing or not is, I believe, still open to debate. I tend to err on the side of not being a bigot, though, so if someone feels they are transgender, I will usually be accepting of their intended and perceived identity. Myself, if I identify as anything, it'd be more likely to be gender fluid than any particular gender - but then, mostly in the sense that I don't identify with either gender all that well. I've been happy being called a man, and online many people assume I'm a woman and that never bothered me either.