From the wikipedia article:
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 would leave some regions of the brain associated with sexual orientation in the 'female typical' arrangement – or attracted to men. Biochemical evidence for this hypothesis was identified in 2017, finding mothers with a gay son, particularly those with older brothers, had heightened levels of antibodies to the NLGN4Y Y-protein than mothers with heterosexual sons