This is the hypothesis to explain what happens in utero: "The mechanism is thought to be a maternal immune response to male fetuses, whereby antibodies neutralize male Y-proteins thought to play a role in sexual differentiation during development"
This explain the feminine inclinationa of their behavior. Gay men are, on average, more feminine than straight men