Animal Farm is an allegory of the Russian Revolution and the rise of Josef Stalin. Through the story, Orwell is attempting to demonstrate the dangers of utopian projects, which carry the risk of degenerating into totalitarian nightmares like Stalin's USSR or Napoleon's Animal Farm. The book is full of fairly transparent references to real historical events, figures, and ideas. Old Major is a Karl Marx figure, making the animals conscious of their own repressed condition and calling for a revolution. Snowball is Leon Trotsky, the hero of the Red Army (Snowball was instrumental in winning the Battle of the Cowshed) who was pushed aside by Josef Stalin. Napoleon is Stalin himself, ruling the Animal Farm through a combination of propaganda and terror. Napoleon's increasingly comfortable relations with the humans is meant to evoke the Nazi-Soviet nonagression pact, and like Hitler, they attack the Animal Farm and destroy the windmill. Napoleon, like Stalin, uses bloody purges (with dogs instead of secret police) to maintain fear and control over the animals.
Orwell called Animal Farm a "fairy story," but it had a very serious point to make about the perils of totalitarianism, one that was made perhaps even more poignant through his use of allegory.