It's due to social prestige.
Let's look at a simple example from the history of English accents: changing "ng" to /n/ at the end of a word.
Today, a word like "going" is pronounced with an /ŋ/ sound (a velar nasal) in a higher-prestige accent, yet with an /n/ sound "goin" in a lower-prestige accent. Pronouncing "ng" as /n/ is seen as less educated or less formal.
In earlier times, pronouncing "going" as "goin" (with an /n/) was the mark of the English aristocracy. Pronouncing it with an /ŋ/ was more common among the lower classes.(See an article on Language Log for some information about this historical switch.)
How exactly this change came about is actually rather interesting from a historical point of view. The suffix marking verbal nouns (like in "a building") was "-inge" in Middle English, while the suffix marking progressive participles (like in "I'm running") was "-inde". The two merged together in southern England in the 1300s, spreading slowly but never quite taking over the whole English-speaking world.