"low-quality," c. 1200, "shared by all," 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.
Of things, "inferior, second-rate," from late 14c. (a secondary sense in Old English was "false, wicked"). Notion of "so-so, mediocre" led to confusion with mean (n.). Meaning "inferior in rank or status" (of persons) emerged early 14c.; that of "ordinary" from late 14c.; that of "stingy, nasty" first recorded 1660s; weaker sense of "disobliging, pettily offensive" is from 1839, originally American English slang. Inverted sense of "remarkably good" (i.e. plays a mean saxophone) first recorded c. 1900, perhaps from phrase no mean _______ "not inferior" (1590s, also, "not average," reflecting further confusion with mean (n.)).