There was a video documentary by someone in Scandinavia where they did experiments on infants, and from a very early age, the differences between male and females start to manifest, even before any sort of social input and differences in treatment. It seems to be biological. Females are more interested in "faces" and the males were more interested in "things".
That doesn't mean women are not interested in STEM though. I've seen a very interesting anecdote at a university in the middle east. It was segregated (men and women had different campuses), and for a certain amount of time, there were the same number, if not more, women than men in the engineering colleges. A nearby university, which was not segregated, and offered practically the same curriculum, had very few women in STEM, most women there ended up in business and media majors. Though things could probably change after graduation where female STEM graduates end up taking work that is less hands on and involves more dealing with people.