poem refers to poetry, which is a countable noun. Because it can be divided into several separate poetry works, each work is an independent individual, so it can be expressed by quantifiers. For example, we can say that "there are five beautiful poems in this book", among which "five" represents the number of poems.
there are other countable nouns similar to poem, such as novel, play, essay and so on.