How many times your girlfriend has complained, you don't understand them, or you can't feel what they feel?
Trust me, it's not your fault that you can't understand. There are certain things of women, that could be only understood by women. Same goes with Men, where women can't understand what men are feeling in every case.
A big company out there in market has products to offer, that cater both to males and females. So, they want to have female participation as well, so the product market fit is not misjudged, and product can come with quality features to serve all classes of society.
Diversity hiring, might not be the ideal weapon to deal with the problem in hand, but this is the easiest weapon corporate have to ensure equal participation, so they can develop product which caters to everyone. The gender gap of picking STEM at school level, specially 'E' , is a very wide pit. This pit alleviate when social obligation come in place for some section of society. Companies cannot go and spend their energy in encouraging female participation in E at elementary level, as this is a seed sown, which will give fruits years after. So, they pick up this weapon, have a female only hiring, get quality participation , select the best from a big pool.
I would draw a line of favouritism where I see quality being compromised in selection. Orgs should be okay with selecting 0 candidates in such drives, if no candidate meets their bar.