"metal piece that works a lock," from Old English cæg "key," of unknown origin, with no certain cognates other than Old Frisian kei. Perhaps related to Middle Low German keie "lance, spear" on notion of "tool to cleave with," from Proto-Germanic *ki- "to cleaver, split" (cf. German Keil "wedge," Gothic us-kijans "come forth," said of seed sprouts, keinan "to germinate"). But Liberman writes, "The original meaning of *kaig-jo- was presumably '*pin with a twisted end.' Words with the root *kai- followed by a consonant meaning 'crooked, bent; twisted' are common only in the North Germanic languages." Modern pronunciation is a northern variant predominating from c.1700; earlier it was often spelled and pronounced kay.
Figurative sense of "that which serves to open or explain" was in Old English; meaning "that which holds together other parts" is from 1520s. As "answer to a test," it is from chess, short for key move, "first move in a solution to a set problem." Musical sense of "tone, note" is 15c., but modern sense of "scale" is 1580s, probably as a translation of Latin clavis or French clef (see clef; also cf. keynote). Extended c.1500 to "mechanism on a musical instrument." As a verb meaning "to scratch (a car's paint job) with a key" it is recorded by 1986.