Stan Lee stated that he came up with "mutants" (which was in the mid 60's) as a generic explanation for different characters having super powers: He was tired of having to come up with unique ways for how every super hero got their powers. The X-Factor gene served as a MacGuffin for mass producing super types.Silentpony said:Because prejudice is the central point of the X-Men. It originally was meant to represent being gay, ie its something you're born with, people hat you for it, your parents ask if you could just stop being it, you have to come out to your friends, yadda yadda. These days it could be extrapolated to represent any genetic disorder or quirk or anything that has some sort of social stigma(Note: I am not saying being gay is a disorder.)
There was zero "gay factor" involved originally[footnote]The extremely limiting Comics Code forbade such mention, in fact.[/footnote]--particularly given that in the mid-sixties there was practically zero tolerance of homosexuality, period, and concerns for homosexual rights, etc, were decades away from being considered a mainstream subject. Race and class rights were the hot topics back then. And Vietnam. Drugs.
Funny how the more things change the more they stay the same.
Early on the "X-Factor" served as a catch all against prejudice in general: Race, culture, religion, country of origin, etc.
The relationship between homosexuality and mutants was consciously and deliberately applied by the directors of X-Men movies both to combat anti-homosexual attitudes and to help non-comic book reading movie goers relate to the in-universe prejudice. "Huh? 'Can't you just stop being a mutant' sounds a lot like--OH! Now I get it!"
OT: The Meta answer is that X-comics' writers harped upon the topic because that was the X-Men's schtick. When mutants showed up in Avengers and the Fantastic Four, etc, the topic of prejudice often failed to get even a mention. It was only when Chris Claremont's run throughout the 1980's made the X-Men Marvel's best selling book that prejudice against mutants really entered the "mainstream" of other Marvel comics "in universe reality".