Keep these straight
Sex — the biological and physiological package: chromosomes, gonads, hormones, internal ducts, external anatomy. Variable, and not always lining up neatly, but not assigned by a committee.
Gender — the roles, expectations, divisions of labour, dress, temperament and identities a society builds and attaches to those bodies. Learned through enculturation, and therefore different from society to society and from decade to decade.
Gender role is what a society expects of you. Gender identity is your own sense of which category you belong to. They are not the same variable, and neither is sexual orientation — who you are drawn to, which is the next section’s question and a genuinely separate one.
Ann Oakley put the sex/gender distinction into social science in Sex, Gender and Society (1972). Gayle Rubin’s “The Traffic in Women” (1975) named the sex/gender system: the machinery by which a society converts biological raw material into gendered persons and then treats the result as natural.
Two honest complications. First, Margaret Mead’s Sex and Temperament (1935) argued from three New Guinea societies — Arapesh, Mundugumor and Chambri — that the temperaments attached to gender are culturally produced rather than given. It remains the founding demonstration in this area, and Deborah Gewertz’s later fieldwork with the Chambri challenged how Mead read them. Contested does not mean discarded; it means read the argument, not the slogan.
Second, the line itself is argued over. Judith Butler and others hold that “sex” is not a neutral fact sitting underneath culture, since the categories we use to sort bodies, and the decision to sort by these features at all, are already cultural work. The two-pile exercise is a teaching tool that gets you most of the way. The seam between the piles is where the current argument lives.