Simone de Beauvoir once wrote that "One is not born, but rather becomes a woman." In other words, the way that we perceive our gender is strongly affected by society and our socialization.
As we grow up, we are socialized by all sorts of influences. Our parents, our teachers, our friends, and the media (among others) all tell us things about what it means to be male or female. We are taught that "boys don't cry" or that it is never proper to hit a girl. We are taught all sorts of things about how society expects us to behave because of our sex. Our own personalities interact with these expectations to create our own gender identity. Perhaps we rebel against expectations and create a gender identity based on that rebellion. Perhaps we accept the expectations. Perhaps we fall somewhere in the middle.
One way or another, biological factors that are inborn in us interact with environmental and social factors to create our personal gender identities.
I can say that gender identity is socially constructed in the west. How we define a person as male/female, strongly idenitifies them. It is also how one sees themselves, through growing up in a society and learning the values society has, and either conforming to them or going against them.
Gender idenitity develops as we grow. We learn our 'place', social status, who we are through our gender male/female.