You can find the answer to this question quite early on in Chapter 8. The answer is that Minimus wrote the poem. He is a pig who is seen as the best writer among the pigs on the farm. The poem he writes in Chapter 8 is called Comrade Napoleon.
The poem is essentially a hymn to Napoleon. By this point, all of the animals are being pushed toward adoring Napoleon as sort of a state religion, almost. This is supposed to represent the way that Joseph Stalin was so admired and adored in the Soviet Union.