The animals attack Frederick and his men because they are going after the windmill, and the windmill is a symbol of Animal Farm.
The windmill is symbolic of the animals’ success in owning their own farm. It also promises them comfort in the future. Frederick and his men are aware that it is a symbol, and this is one of the reasons why they attack it.
Meanwhile Frederick and his men had halted about the windmill. The animals watched them, and a murmur of dismay went round. Two of the men had produced a crowbar and a sledge hammer. They were going to knock the windmill down. (ch 8)
When Squealer indicates that the battle was a success, the animals are surprised.
"But they have destroyed the windmill. And we had worked on it for two years!" (ch 8)
The animals cannot stand the idea of the men taking advantage of them, and they hate to see the hard work that they put into the windmill go to waste. It is a matter of pride as well as practicality.