Here's Webster on "gender":
1 a : a subclass within a grammatical class (as noun, pronoun, adjective, or verb) of a language that is partly arbitrary but also partly based on distinguishable characteristics (as shape, social rank, manner of existence, or sex) and that determines agreement with and selection of other words or grammatical forms b : membership of a word or a grammatical form in such a subclass c : an inflectional form showing membership in such a subclass
2 a : sex
It's the secondary definition which is of interest. Notice (b): 'behavioral, ...psychological traits...'? That's the usage of the queer propagandists. "Behavioral, cultural, psychological" attributes are, in fact, accidents, not essence.
Notice that the MSM (among others) parrots the term? It's in their scripts. They will never use the term "sex" as in "The baby is of the male sex." That's because "sex" connotes essence (albeit secondary; the principal essence is "human" or "bird" or "fish.")
For the artful liar, "gender" as in #2 above is a gift which will keep on giving. Utilizing the term allows re-defining humans. We saw a glimpse of this redefinition process in Kennedy's infamous 'whatever you want to be' language at SCOTUS and that hairball has simply grown since then. Like all hairballs, it's a sticky, ugly, mess, the composition of which you really don't want to know.
So when you hear that term "gender" it is foolhardy to engage an argument. You will lose unless you are actually dealing with a 'behavioral, cultural, psychological' discussion. Force your interlocutor to admit to essence: sex.
UPDATE: See also this post from Grim.