Nobody really knows why some people are attracted to the same sex.
Various theories like a special gene or a dominant parent have been put forward to explain why. I know families where only one brother has become gay while the others seem perfectly well adjusted heterosexuals. I also knew a businessman who lived a perfectly normal life for years as a married man and produced three children before leaving his wife to set up home with another male. Some people are bisexual and are attracted to both sexes. They have been part of society since ancient times.