Gentlemen, brace yourselves: once upon a time, you were a girl. Strictly speaking, when you were just an overgrown ball of cells in the womb, you were female — but fortunately a few things happened along the way to ensure you were all man by birth.
This video explains the whole process, which boils down to the fact that the early stages of development are dictated by the X chromosome, common to both male and female. After a while though, the male Y chromosome kicks in. [ASAP Science]