The song was unusual both lyrically and musically.
The history of the lyric begins with three different song ideas that Lennon was working on. The first of which was inspired by hearing a police siren while at his home in Weybridge. Lennon wrote the lines "Mis-ter c-ity police-man" sang to the rhythm of the siren. The second idea was a short rhyme about Lennon in his Weybridge garden. The third idea was a nonsense lyric about sitting on a corn flake. Lennon was unable to finish the ideas as three different songs and instead chose to combine them into one.
Sometime later, Lennon received a letter from a pupil of the Quarry Bank School. The writer mentioned that their English master was making his class analyze Beatles' song lyrics. (John wrote an answer to the letter, dated September 1, 1967, which was auctioned by Christie's of London in 1992).
Lennon, amused that a teacher was putting that much effort into understanding Beatles lyrics, decided to write the most confusing, unusual lyric he could. Lennon called childhood friend, Pete Shotton, and asked him about a silly playground nursery rhyme that they used to sing when they were kids.
Shotton reminded Lennon of the words; "Yellow matter custard, green slop pie, All mixed together with a dead dog's eye, Slap it on a butty, ten foot thick, Then wash it all down with a cup of cold sick". Lennon borrowed a couple of words from the rhyme, added the three old unfinished ideas and the result was the lyrics to "I Am The Walrus". Upon finishing the lyric, Lennon remarked to Shotton, "Let the fuckers work that one out."
The "elementary penguin" that chanted Hare Krishna, mentioned in the song was a little dig at Allen Ginsberg who made a habit of chanting the Hare Krishna mantra at numerous public events.
"The walrus" idea is from Lewis Carroll's poem The Walrus and The Carpenter.
The unusual talking towards the end of the song is actually a few lines of Shakespeare's King Lear, Act IV Scene VI, which were added to the song direct from an AM radio receiving the broadcast of the play on the BBC Home Service (or possibly the BBC Third Programme).
The recording of "I Am The Walrus" featured, in addition to a great performance by the Beatles themselves, violins, cellos, horns, clarinet and a 16 piece choir.
The 1968 Beatles song "Glass Onion", written by Lennon, and featured on the White Album, refers to earlier Beatles compositions. Mentioning "I am the Walrus", Lennon sings, "Here's another clue for you all, the walrus was Paul." This was supposedly another clue in the "Paul Is Dead" phenomena, as the walrus was assumed by some fans to be a symbol of death.
The song has been parodied as "Hey, Diddle Diddle" by The Rutles (the Rutles TV show includes a brilliantly accurate parody of the song's appearance in Magical Mystery Tour), and as "The Mole from the Ministry" by The Dukes of Stratosphear (actually XTC). It was also a major influence on "Sowing the Seeds of Love" by Tears for Fears.