1849, said to be originally a hobo term (but attested in London underclass from 1851), of uncertain origin; perhaps from monk (monks and nuns take new names with their vows, and early 19c. British tramps referred to themselves as "in the monkery"). Its origins seem always to have been obscure:
Sir H. Rawlinson can decipher cuneiform, but can he tell us why "moniker"--the word has a certain Coptic or Egyptian twang--means a name painted on a trunk? ["The Saturday Review," Dec. 19, 1857]