At school, we're usually taught that a verb is an "action" word, or a "doing word", because it describes what someone or something is doing.
That's useful for a class of 10-year-olds learning the very basics of grammar, but it's also not quite the full story.
Some teachers will tell you that verbs can describe actions and states, and that's a bit better, but still not quite there.
A verb, in fact, is a unit of speech which takes a subject, and which often changes in a certain way -- we say it "conjugates".
So, "to be" is a verb because it takes a subject, and it conjugates: in the sentence "I am the walrus", "I" is the subject, and "am" is the conjugated version of "to be" which agrees with the subject.
To be sure, "to be" is a special kind of verb called a "cupola", but it is still a verb.