PLEASE NOTE: The following piece contains major, and I mean major spoilers for the film X-Men: First Class and several decades worth of storylines from the X-Men comic books. You have been warned.
The ending of X-Men: First Class is essentially perfect, in terms of how it both meets and subverts audience expectations - a textbook example of how to keep an audience riveted by an ending they knew was pre-ordained (it is, after all, a prequel.)
Having used their mutant powers to save the human race from nuclear annihilation, the proto-team of X-Men under the leadership of Charles Xavier and Erik "Magneto" Lensherr learn that - rather than being grateful - the humans they just rescued are so terrified at the sight of the Mutants' superhuman abilities that they've decided to wipe them out with a volley of missiles. Idealistic Charles wants to defuse the tension and work to reassure humanity that they have nothing to fear, but Erik - a Holocaust survivor who's heard this song before - grimly intones "Never again!" and declares war on humanity. They fight, and the ensuing struggle sets each man firmly on the course to the forms we recall them in from the "future" films: Professor X, the saintly, wheelchair-bound MLK/Ghandi figure of Mutant Rights and leader of the X-Men; and Magneto, the vengeful-yet-sympathetic Mutant Supremacist leader of The Brotherhood.
It's a great ending not just because of its elegant handling of the obligatory "Oh, that's how that happened!" reveal, but also in the way it wrings tragedy out of this key event by spending the rest of the film playing the two main characters as deceptively different from how we may have imagined them. Young Xavier... is kind of a huge prick. Until asked to do otherwise by the CIA, he's mainly using his gifts to impress girls. Oh, he's "idealistic" about peace and togetherness, sure - but his idealism isn't yet grounded in anything other than his own naivete and smug presumptions. It's all-too-easy for him - an independently-wealthy genius whose mutation is invisible to the naked eye - to integrate and "get along" with humanity, so it must be just as simple for all Mutants... even his best friend, blue-skinned Raven (aka "Young Mystique") - for whom "passing" means constantly walking around disguised as a "normal" person. In a perfectly tragic final touch, he's oblivious-to-the-point-of-cruelty to Raven no longer being content at being regarded like his flesh-and-blood Imaginary Friend.
Young Magneto, on the other hand, is for all intents and purpose already a full-blown superhero: a Jewish James Bond traveling the world using his powers to hunt down Nazi war-criminals. Like any Movie Badass worth his salt, he's a reflexive loner wary of team-affiliations and suspicious of everyone's motives, but unlike Xavier, his assumptions come from experience - he survived a Nazi Concentration Camp. He's also, in a brilliant twist, the vastly more emotionally attuned of the two men: He tells Raven that she's beautiful in her natural state, and means it. When the younger recruits cause a ruckus experimenting with their powers and making up codenames, Charles scolds them - Erik clearly gets a kick out of it.