common pet form of the fem. proper name Margaret, attested since Middle English. Compare magpie. Mag's tales "far-fetched stories, nonsense" is from early 15c.
1871, nonsense word (perhaps based on jabber) coined by Lewis Carroll, for the poem of the same name, which he published in "Through the Looking-Glass." The poem is about a fabulous beast called the Jabberwock.