What was the purose of the ten commandments of "Animalism," and how were they altered by the pigs?
The purpose of the commandments was to explain to the animals in the simplest of ways what the idea of Animalism was all about. The feeling was if all animals could live by these tenets, the revolution would be a success and Animal Farm would flourish the way Old Major described in his speech.
When the pigs get control, they change the commandments in every way shape and form. They distort some, simplify others, and downright eliminate those that are inexplicably broken. The pigs break the commandments such as no animal shall hurt other animals, so they tack on "without reason" to the end. They say no drinking, but they add "to excess" to the end. They say no dealing with money or humans, but when these get broken, those commandments go away. In the end the only remaining commandment is something that bears no resemblence to any of the original ones: "All animals are equal, but some are more equal than others."
Animalism was created by the animals in purpose of the Rebellion. Then ten commandments was the law of Animalism, and all animals had to follow those rules no matter what.
However, as the need for products (that could not be grown on the farm) increased, the pigs soon started communicating with humans in order to get these products, mainly beer, as the pigs and dogs got addicted to it. Contact and interaction with the humans influenced the pigs, who then began to walk on two legs, wore clothes, and drank alcohol.
Since they were breaking the law by doing all these things, they secretly gave themselves permssion to alter the ten commandments so that it seemed that they wouldn't be breaking the rules.