That particular song, like many produced in that same decade, was a product of drugs and getting high. Similar to an old classmate of mine writing a story about gum-people eating humans while he was high, [I Am The Walrus] so is much of the lyrics.
However, of the few bits that do make sense, the Walrus is a reference to the walrus in Lewis Carroll's "The Walrus and the Carpenter" (from [Through the Looking-Glass]). Of course, Lennon didn't know the walrus was an epitome of evil. But... oh well. We can't know everything.
Also, the eggman, where it originated from, was supposedly Eric Burdon. He's the lead singer of [The Animals], claimed by some to be the 'Eggman'. Burdon was known as 'Eggs' to his friends, originating from his fondness for breaking eggs over naked girls.
I hope that helps you. If not, visit the source link (aka: Wikipedia).