According to the American Association of Pediatrics Gender is a socially determined identity. Gender is based on how a person feels specifically as it relates to how the society that person lives in believes that biological sex should act. Each individual is unique, so each person's Gender should be considered unique, and each society in history has had different standards for Gender roles. So, this topic is very subjective, yet real since so many are engulfed in it.
What this means is that if a person grew up alone their gender would perfectly match their biological sex because there are no preconceived notions or expectations on that person. The Gender issue has increased as a problem as society puts expectations on people that doesn't match their own personal expectations for their biological sex.
The pressure and conflict from this clash of societal will and personal will have resulted in something called Gender Dysphoria. Because Gender is changing term based on person, place, and time and complicated by other social and emotional issues most attempts to discuss the topic end up in ideological conflict instead of caring and personal discussion.
Sex is a biological construct, what is real:
Attributes that characterize biological maleness and femaleness including:
Gender is a social construct, or 'man-made':
Attitudes and feelings that a given culture associates with a persons biological sex such as:
Gender roles and behavioirs
This Varies by time and culture
I am not able to identify to what degree the AAP's views are accepted or rejected by other organizations.
PDF, slide 7, from the AAP