These are not MY words, but the words of a very skilled writer and a professor of biology. It is the clearest and most concise explanation for "gender identity" I have ever read. He said I could share it here. It does end rather abruptly as it is part of a longer personal email. But this part was just too good not to publish.
It’s important to point out that gender roles, gender expression, gender identity, sexual orientation, and biological “sex” are (at least) all separate things. Often they are conflated because usually there is agreement among all of them. But the important word there is usually. The fact that there exists variations and disagreements within and among these categories helps illustrate how they are fundamentally different.
Gender roles are cultural traditions about what a person should do based on their gender. E.g., men hunt while women garden... until that changed and then only real men know how to properly tend to a farm. Data entry was women’s work... until it was decided that programming was manly. So gender roles are highly mutable and subjective in both time and place.
Gender expression is a set of behaviors and mannerisms an individual chooses as a way of demonstrating or validating their gender. Which is manlier: A short buzzcut or a long, virile lion’s-mane of hair? I dare you to tell a Hell's Angels biker he looks like a woman. Which is more feminine: a simple ponytail or a delicate pixie cut? Could anyone sane argue that Audrey Hepburn was anything but feminine? Is it a kilt or a skirt? A dress or a kaftan? Gender expression strongly depends on how that particular piece (article of clothing, style, mannerism, etc...) is framed and interpreted by the individual.
Gender identity is the internal sense of your innate self (whatever that means). Conceptually this is the most difficult to describe since most folks never question their own gender identity much as how fish don’t really understand water... until they suddenly find themselves flopping about on the bottom of a boat wondering why they can’t breath. Currently, evidence suggests gender identity has a strong neurological basis and starts to get established during the middle to end of the first trimester of embryonic development but the exact mechanism which steers (or misdirects) that is unknown and could be genetic, epigenetic, environmental, or (most likely) some combination. This is a rather thoughtful essay on some of the challenges regarding recognizing and validating gender identity:
Sexual orientation barely even belongs here because orientation isn’t about self identity or roles but, rather, what you find enticing and attractive. But it's often lumped together due to the strong correlations between sex and gender (i.e. most people identify as either male or female and usually are attracted to some form of the opposite). As with gender identity, it seems like sexual orientation is also neurological and established during early development but the exact mechanism is also unknown. There is an expression that, “Orientation is who you want to go to bed with, identity is who you want to wake up as.” Sexual orientation is much more varied than, “do you like guys or girls?” and even the terms hetero-, homo-, and bi-sexual are kind of limited and don’t really provide as much information as most folks assume. For example, if a guy finds a masculine woman attractive, does that make him homosexual? What if he develops feelings for a transwoman? It’s better to describe what you’re attracted to, e.g., “I totally like guys”, “Sorry, I’m strictly into ladies”, “Hey, I can appreciate whatever!”, etc... because then you’re not making assumptions about how the person thinks of themself. Making assumptions and thinking that gender and orientation are linked leads to stupid and dangerous things like, “If you like guys, why would you get a mastectomy and take testosterone? You’d be able to find a boyfriend much easier if you looked like a woman.” Etc. That literally causes people to commit suicide or be murdered.
And then there is “sex”. I’m indicated that parenthetically since it’s a lot more nuanced and complex than assumed. For “sex”, it’s generally thought of as some degree of feminization vs masculinization. The most often situation is an individual who is either highly feminized with little masculinization or highly masculinized with little feminization. But it’s important to point out that those aren’t mutually exclusive and there are individuals who are both highly feminized and masculinized and others who are not particularly differentiated either way. To further complicate matters, individual cells can be sexually differentiated, tissues can be sexually differentiated, organs can be sexually differentiated, and individuals can be sexually differentiated... but there doesn’t necessarily have to be agreement among all of those levels. Individuals exist who carry the “masculinizing gene” (SRY gene, located on the Y-chromosome) but their cells don’t recognize the signal. There are people who are chimeras--a mix of XX and XY cells, causing entire tissues or organs to develop and differentiate as a different sex that the surrounding tissues. In fact, let me just give you this link to a very interesting article (includes a worthwhile short audio interview):