It's the government, they put (((the gay))) in the vaccines to give people autism!
No one really knows for sure, but here are a few points:
I'd image it's due to multiple factors, such as biochemical (e.g. hormone exposure during brain development) and biological (e.g. genes that affect brain development/structure and the effects certain visual triggers have on the brain) factors.
It ain't a choice. You can repress homosexual desires, but you can't prevent the brain from reacting to your environment the way it does. Of course there is a gradient to this. One person may have developed one way and finds features from the same sex attractive but doesn't have any homosexual desires, while another may just straight up want gay sex.
Genetics are a weird one, so I'm going to simplify it a good bit (geneticists please don't hurt me). There probably aren't any specific genes that just straight up make you homosexual, but genes that code for specific proteins that can be activated when exposed to other factors (such as being exposed to specific hormones in a specific range of concentrations) are plausible and could partially explain why homosexuals develop the way they do.
For example, let's say there is a gene that activates when there is an excessively high concentration of estrogen present, it produces proteins that break down the excessive estrogen but also affects how neurons signal each other in a certain part of the brain (e.g. maybe the protein can also bind to certain cell receptors that it's not really meant to and induced a chemical change in the neurons it binded to, which then affects the cells function) which would then change the brain's response to an environmental stimuli and so the individual's behaviour as a whole.
I'm no expert and I'm not saying this is the reason why people are gay, but I'm just saying don't rule out genetics as a factor because it's complicated as f***.