Though the nursery rhyme character Humpty Dumpty is commonly portrayed as an egg, he is never explicitly described as such in the short rhyme; some theories hold that the inspiration for the rhyme can be traced back to a military cannon or to King Richard III, who is known to have had a hunched back, or humpback. The story of the cannon holds that an English man singlehandedly defended his town from an advancing army with the help of a cannon perched on top of a wall. However, the heavy cannon eventually fell down off the wall and couldn't be lifted back up, after which the townspeople had to surrender.
The theory relating to Richard III holds that the king rode a horse named Wall into battle and fell off. There are a few other bits that could possibly link Richard III to the rhyme, but there isn't a lot of evidence to support either story or even the idea that Humpty Dumpty was a story referencing an actual event. It seems more likely that the rhyme was intended as a riddle for children to solve. The riddle seems to point to an egg, which could explain why Humpty Dumpty is so commonly depicted as an egg.