The genesis of the lyrics is found in three song ideas that Lennon was working on, the first of which was inspired by hearing a police siren at his home in Weybridge; Lennon wrote the lines "Mis-ter cit-y police-man" to the rhythm of the siren. The second idea was a short rhyme about Lennon sitting in his garden, while the third was a nonsense lyric about sitting on a corn flake. Unable to finish the ideas as three different songs, he combined them into one.
"It never dawned on me that Lewis Carroll was commenting on the capitalist and social system. I never went into that bit about what he really meant, like people are doing with the Beatles' work. Later, I went back and looked at it and realised that the walrus was the bad guy in the story and the carpenter was the good guy. I thought, Oh, shit, I picked the wrong guy. I should have said, 'I am the carpenter.' But that wouldn't have been the same, would it? [Singing] 'I am the carpenter....'"