Science has established that sexual orientation is determined by multiple factors, including environment and biology, and not a single gene, though previous studies have shown someone is more likely to be gay based on certain genetics. One study showed a gene gave gay uncles and aunts the purpose of looking after nieces and nephews to "nurture the family tree".
If homosexuality were a mutation or a defect like you suggest, you would think it would be treatable. But it isn't. Multiple studies show conversion therapy is a failure, and gay people can resist acting on their attractions, but cannot stop their attractions.