Gender [/B]is a more complex concept. Used at a cultural level, it means the behavior, appearance, and roles society expects of people, based on their assigned sexes. Those can differ from one culture and one time to another. Used individually, it can refer to your own perceptions and identity, regardless of your assigned sex at birth or the social perception of your gender.
Intersex people can have varying gender identities, like anyone else. Most have a gender identity that matches the sex they were assigned at birth. Being intersex isn't the same as being transgender. But if someone with intersex traits identifies with a gender different from their sex assigned at birth, they might consider themselves transgender. Or they might identify as nonbinary – meaning neither male or female – or other genders.
"Gender" was historically just a synonym for sex. Until the mid-20th century, it was used grammatically (masculine, feminine, neuter) or interchangeably with sex in legal and medical texts. The idea that "gender" is a separate, self-defined identity was pushed largely by psychologist John Money, whose theories were debunked by the failure of his most famous case (David Reimer). So no, I’m not buying into this new-age bullsh*t about "gender."