The original sense was ‘common to two or more people’, later ‘inferior in rank’, leading to mean (sense 3) and a sense ‘ignoble, small-minded’, from which mean (sense 1 and mean sense 2) (which became common in the 19th century) arose.