Answer by taking a quote from the following article:

Legion (David Charles Haller) is a fictional superhero appearing in American comic books published by Marvel Comics. He is the mutant son of Professor Charles Xavier and Gabrielle Haller. Legion takes the role of an antihero who has a severe mental illness including a form of dissociative identity disorder, in which each of his alternate personas controls one of his many superpowers. The television series Legion premiered on FX network in 2017.

Charles Xavier met Gabrielle Haller while he was working in an Israeli psychiatric facility where she was one of his patients. Xavier was secretly using his psychic powers to ease the pain of Holocaust survivors institutionalized there. The two had an affair that resulted in the birth of their son David. Xavier was initially unaware of this, as Gabrielle never told him she was pregnant.  When he was very young, David was among the victims of a terrorist attack, in which he was the only survivor. The trauma of the situation caused David to manifest his mutant powers, incinerating the minds of the terrorists. In the process, he absorbed the mind of the terrorist leader, Jemail Karami, into his own. Being linked to so many others at their time of death, he was rendered catatonic, and remained in the care of Moira MacTaggert at the Muir Island mutant research facility. The trauma caused David's personality to splinter, with each of the personalities controlling a different aspect of his psionic power.  Karami struggled for years to separate his consciousness from David's. Using David's telepathic abilities, he reintegrated the multiple personalities into David's core personality. Some of the personalities resisted Karami, and two proved to be formidable opponents: Jack Wayne, a swaggering adventurer, who commands David's telekinetic power, and Cyndi, a temperamental, rebellious girl who controls David's pyrokinetic power. Wayne intended to destroy Karami's consciousness to preserve his own independent existence within David's mind. Neither personality succeeds, and Karami, Wayne, and Cyndi continue as David's dominant personalities.  During his time at Muir Island, David emerged from his catatonia. Soon after, David was possessed by the Shadow King, who used his powers to psychically increase the amount of hatred in the world and feed on the malignant energy. During this time, the Shadow King, as David, killed the mutant Destiny. The X-Men and X-Factor fought the Shadow King, and as a result, David was left in a coma.

Who had the affair?
Charles Xavier met Gabrielle Haller