Wolverine remembered due to a loophole. Scarlet Witch's altering of the world wasn't solely to create a world where mutants rule, but also, the Scarlet Witch gave many of the X-Men and New Avengers their "heart's desire" (perhaps to keep them content enough to not try to undo things, similar to what was done in a recent Agents of SHIELD storyline on TV).
Wolverine's heart's desire was to remember his past. Before this, everything prior to the Weapon X program was gone or so hazy and potentially implanted that it couldn't be trusted. So, when House of M hit, he got his wish and remembered the parts of his life he had previously not known (including his real name)... however, "remember everything" ALSO includes remembering the world as it was before House of M, which everyone else forgot.
As a side note, Wolverine wasn't the only person to remember: Layla Miller also was able to.