John Lennon got the idea for I Am the Walrus after finding out that there was a class devoted specifically to interpreting meanings behind the songs of The Beatles, his wish apparently being to make these people and others like them miserable. His inspiration for including the famous 'walrus' reportedly came from the Lewis Carroll nursery rhyme The Walrus and the Carpenter.
Despite the nod to a story meant for children, many elements of the song seem to refer to disturbing things, including acts of violence against police. Other parts are just strange. In addition to the narrator declaring himself the 'walrus', he also styles himself as the 'eggman'. There's also an Edgar Allan Poe reference for good measure.
But even though it's well-established as to why Lennon created the song, there has still been debate over whether or not the song is truly gibberish, or if there is actually a real message behind it. Some seem to have floated the idea that it was about his disillusionment with the 'hippy' movement.
Conversely, it has also been suggested that the song was a warning to the movement about what lengths 'The Establishment' might go to in order to silence them.