It can depend on the specific person, as no one is exactly the same, but a large majority find out during puberty/early teenage years.
No one wants to be gay. For most gay men, when they first realize they are gay, they are sad about it. Gay people have fewer recognized rights than straight people, and much more harrassment. Gay men must learn to accept themselves, and then they can live happy lives.
They do not realize they are gay, because they are not gay.
You can be. Some people realize their sexuality very young.
First of all, gay people only make up about 3% to 8% of the population. Secondly, you wouldn't know someone is gay unless they told you, so you probably see gay people every day and don't realize it.
People are gay as soon as they are conceived. The child may not realize it until they are in their teens, but they are always gay. You are born that way.
To graph a line, you must first realize that you are a gay anus buddy.
Can a child become gay if they are straight? No. You are born gay or you are not. Some people don't realize it until later on life, but there is no "switching back and forth."
When you realize you are gay
There have been gay people long before there were countries. The first "country" in the world, whatever that was, would have had gay people in it.
Gay people are gay from birth. Straight people are straight from birth. Most gay men report knowing they were gay around the time they hit puberty (age 13 or so).
Virtually all gay men realize they are gay by puberty.
Nobody can turn gay. Sexual orientation is something you're born with, and it is natural and unchangeable. Most people realize their orientation at puberty.