This question restates the perennial nature versus nurture debate. Does genetics or environment play a larger role in our formation?
The answer is that it’s a mixture.
When I was growing up, I was surrounded by media and society that showed heterosexual relationships overwhelmingly. Yet, I’m still gay. That was genetics at play.
That same media and society filled me with messages stating homosexuals were undesirable and less-than. They were homophobic biases. I learned and internalized those messages, and it took many years of good therapy to overcome that nurturing.
It’s a mixture of nature and nurture.