In those years there was strong public disapproval of homosexuality, and laws against homosexual acts all over the U.S.A. That meant that government employees who were homosexual were vulnerable to blackmail.
Employees in areas connected with national security, in particular, were subject to recruitment by Soviet spies via blackmail. This was the height of the Cold War, remember. Consequently, and very reasonably, federal departments, especially the most security-conscious ones like State and Defense, fired employees who were found to be homosexual.
NASA in the 1960s took the same approach. At least one NASA employee was fired for homosexuality while James Webb was NASA chief.
No surprise then that earlier this year homosexual activists fired up a campaign to rename the James Webb telescope. It would be wrong, wrong they said to name such a major project after a homophobe.
Leaving aside the fact that James Webb is not known to have had any active part in firing homosexuals, this ignores the other fact that in the 1960s approximately ninety percent of Americans were homophobic by the standards of 2021.