I just answered this again at the top. I'll provide a summary again here.
Before I do - I think it's important to clarify that the question I am answering is about how we understand gender identity/ gender incongruence. Of course when we have a child in front of us and we are trying to figure out what might be going on for that child, we must ask them these questions - "why do you think you are a girl? How do you know that? What does being a girl mean to you". If a child says - "I think I'm a girl because I like wearing dresses, then we can work with that child to help them understand that wearing dresses doesn't make a person female, and that boys can wear dresses if they want.
However - it terms of how we understand what gender identity is:
A person's gender identity concerns their recognition of themselves in relation to sex and gender categories such as male, female, boy and girl.
A lot of pps on this thread are assuming that when a child says "I'm a girl", they must have arrived at that identification by comparing themselves with some set of characteristics they associate with girls. For example, "I like dresses, girls like dresses, therefore I'm a girl", or "girls have vulvas, I have a vulva, therefore I'm a girl".
But why assume that this is how gender identification works?
In fact, classic cognitive-developmental theories distinguish children's basic identification with a gender category from their knowledge of the stereotypes and characteristics associated with that category. They propose that developing gender identification itself motivates children to explore what being a boy or girl means socially.
A couple of days ago a pp asked me how my daughter knows she is a girl. (My daughter isn't trans - she was born female). She's 4. The convo went like this (I'm paraphrasing as I can't remember the words exactly):
me: DD how do you know your a girl.
DD: Because I know I'm a girl. Because I am a girl.
Me: But how do you know that?
DD: Because I am a girl.
Me: But how do you know?
DD: Because I can see I'm a girl.
Me: What do you see?
DD smiles at me like I'm bonkers and runs off.
My DD doesn't know about XX chromosomes, and she didn't refer to her anatomy, clothes or interests. Nor did she say, "Because you told me I am."
Now, it's perfectly possible that she originally acquired that identification because everyone around her has always called her a girl. But the important point is that her identification doesn't appear to depend on consciously comparing herself with a list of characteristics associated with girls. She simply recognises herself as a girl.
And if gender identification were simply a matter of internalising the category assigned to us by others, how do we explain children who have consistently been told they're boys, yet persistently and insistently identify as girls?
PP's on this thread are insisting that they must have learned some beliefs or stereotypes about girls and mistakenly concluded that those characteristics apply to them.
But why must that be the explanation? It's one possible hypothesis, certainly, but where is the evidence that it's the correct one? People can't establish this by simply insisting that no other other explanation makes sense to them.
Another possibility is that our capacity to recognise ourselves in relation to sex categories is influenced by underlying neurodevelopmental processes. Language and social learning provides the concepts through which that recognition becomes activated, but the underlying neurocognitive processes may themselves be biologically organised rather than simply acquired through social learning.
To me this latter theory is a much better fit with the body of empirical evidence we have.