In decades past, being homosexual was considered a risk factor for intelligence agents. An adversary who knew they were gay could threaten exposure, thereby gaining a lever to potentially turn the agent. So they tried very hard to keep gays out of the intelligence services.
I don't know if the US still does this. I'd be a bit surprised. I wouldn't be surprised if Russia still did, though.