I hope this doesn’t sound chauvinistic, it’s not meant to be.
There are many factors involved for why there are so few women in IT, the smart-girl as a negative, few role models, guidance to other careers, etc. but the actual root of it is much simpler. Men are generally thinkers, problem solvers, “thing”-people, while women are emotional creatures, nurturing, they are “people”-people. They tend to collect in database administration because such a thing requires management/care-taking, but it’s hard to think of coding a program as the act of “nurturing”. It’s much closer to a “solve the puzzle and go to the next level” exercise, like so many video games.
So this starts at a young age. Girls will play video games to have “fun”. Boys will play video games to prove they can “conquer”.
That’s my take anyway.