In human beings, sex of an individual is determined:
At the time of fertilization
The sex of the child depends on the type of sperm that fertilises the egg. Each egg contains one X chromosome and a sperm may have either an X or a Y chromosome. It is a matter of chance as to which type of sperm fertilises the ovum. If the egg (having X chromosome) is fertilised by a X-bearing sperm, the resulting combination is XX i.e., female. If the egg (having X chromosome) is fertilised by a Y-bearing sperm, the resulting combination is XY i.e., male.