Lennon dubbed the Maharishi "sexy" after hearing he hit on the actress Mia Farrow, who was also at the camp. Farrow's sister, Prudence, was there as well, and her experience led Lennon to write "Dear Prudence
By the time George Harrison and John Lennon caught wind of Maharishi's discretions, Paul McCartney and Ringo Starr had already left, but they had planned to leave early. According to Lennon, when he and Harrison confronted Maharishi to tell them they were leaving, Maharishi asked why, and Lennon said, "If you're so cosmic, you'll know why."
This was the end of The Beatles' association with Maharishi Mahesh Yogi, but they did continue to explore meditation and Eastern philosophy. Harrison, in particular, delved much deeper into his teachings and came to believe in reincarnation.
As for the Maharishi, it's not clear if he did anything wrong at the camp, as Lennon may have gotten bad information from those trying to curry favor. This song though, sullied Maharishi's reputation and derailed the Transcendental Meditation movement.