French nursery rhyme hero (the rhyme first attested in English 1810), earlier "a short, clumsy person of either sex" (1785), probably a reduplication of Humpty, a pet form of Humphrey. Compare Georgy-porgy, etc. Originally, humpty-dumpty was a drink (1690s), "ale boiled with brandy," probably from hump and dump, but the connection is obscure and there might not be one.
'It's very provoking,' Humpty Dumpty said, ... 'to be called an egg — very!' ["Through the Looking-Glass," 1872]