1440, from M.Du. pegge "peg," a common Low Ger. word of uncertain origin (cf. Low Ger. pigge "peg," M.Du. pegel "little knob used as a mark"). The verb meaning "fasten with or as if on a peg" is first recorded 1598, from the noun. Slang sense of "identify, classify" first recorded 1920. To be a square peg in a round hole "be inappropriate for one's situation" is attested from 1836; to take someone down a peg is from 1589, but the original lit. sense is uncertain (most of the likely candidates are not attested until centuries later).