That's because gender is a function of culture, and other mammals either don't have enough culture, or we just don't understand it. Golfing Gator is correct, "sex" and "gender" are two different things, but there are a lot of people in this country who don't know that. It's not taught very comprehensively in schools, so I don't blame you for only knowing the very simplest of definitions.
"Sex" is biological. Men are usually taller, with upper body strength and boy-parts. Women are usually shorter, with wider hips and girl-parts. Almost everyone you've ever met falls into one or the other. It's pretty straightforward, and the same here and now as it is across national borders or back in time. That's why your birth certificate lists "Sex" and the 19th Amendment outlaws voting restrictions "on account of sex," rather than gender.
"Gender" is your role in society. In our society, men are more likely to be called Steve, wear pants, and play with Hot Wheels, because names, clothes, and toys are all aspects of culture. Women are more likely to go by Stephanie, wear dresses, and play with dolls. It varies by culture and time; for example, men wear kilts in Scotland, thobes in Arabia, and kimonos in Japan, and in Ancient Rome they wore togas, all of which could come across as dresses here. That's because our culture mostly associates dresses with women, and pants with men.
And there are some people who just like the opposite gender's roles, that's all. There are plenty of historical accounts to show that there have always been trans people, but the social pressure of conformity has kept most (but not all) of them from expressing it. I'm guessing that you're Gen X or older, because this wasn't even discussed much before about the 1990s ...
... mostly. It was there, though. Tell me; when you were growing up, was there a girl or two in your class that everyone considered a "tomboy"?