c. 1200, mēne, "shared by all, common, general," a sense now obsolete, shortened from imene, from Old English gemæne "common, public, general, universal, shared by all," from Proto-Germanic *ga-mainiz "possessed jointly" (source also of Old Frisian mene, Old Saxon gimeni, Middle Low German gemeine, Middle Dutch gemene, Dutch gemeen, German gemein, Gothic gamains "common"), from PIE *ko-moin-i- "held in common," a compound adjective formed from collective prefix *ko- "together" (Proto-Germanic *ga-) + *moi-n-, suffixed form of PIE root *mei- (1) "to change; exchange." Compare second element in common (adj.), a word with a sense evolution parallel to that of this word.
Meaning "of common or low origin, inferior in rank or status" (of persons) is attested from early 14c. Sense of "ordinary, inferior in attainment or skill" is from late 14c. Also from late 14c. as "poor in quality, of little value," though this sense survived longer in American than in England. James Stirling, in "Letters from the Slave States" [London, 1857], mentioning mean whites (poor whites in the South who do manual labor and are looked down on by the slaves) notes, " 'Mean' is an Americanism for 'poor,' 'shabby.' They speak here of a 'mean' hotel, a 'mean' dinner, &c."
The pejorative sense of "without dignity of mind, destitute of honor, low-minded" is from 1660s; the specific sense of "stingy, niggardly" is recorded by 1755; the weaker sense of "disobliging, pettily offensive" is from 1839, originally American English slang. All these developments of the English word were furthered by its coincidence in form with mean (adj.2) "middle, middling," which also was used in disparaging senses, and OED notes that some usages of mean it cites "might be referred almost equally to the native and to the foreign adj.; the truth is probably that they are of mixed ancestry."
The inverted sense of "remarkably good" (as in plays a mean Rhythm Master) first recorded c. 1900, perhaps from phrase no mean _______ "not inferior" (1590s, also, "not average," reflecting further confusion with mean (adj.2.)).