1822, diminutive of mate (n.) in its "male friend" sense. With -y (3).
Entries linking to matey
mate n.1
mid-14c., "associate, fellow, comrade;" late 14c.,"habitual companion, friend;" from Middle Low German mate, gemate "one eating at the same table, messmate," from Proto-Germanic *ga-matjon, meaning "(one) having food (*matiz) together (*ga-)." For *matiz, see meat. It is built on the same notion as companion (which is thought to be a loan-translation from Germanic). Cognate with German Maat "mate," Dutch maat "partner, colleague, friend."
Meaning "one of a wedded pair" is attested from 1540s. Used as a form of address by sailors, laborers, etc., at least since mid-15c. Meaning "officer on a merchant vessel" is from late 15c.; his duty is to oversee the execution of the orders of the master or commander.
-y 3
suffix in pet proper names (such as Johnny, Kitty), first recorded in Scottish c. 1400; according to OED it became frequent in English 15c.-16c. Extension to surnames seems to date from c. 1940. Use with common nouns seems to have begun in Scottish with laddie (1546) and become popular in English due to Burns' poems, but the same formation appears to be represented much earlier in baby and puppy.