It came from a myth. There are different versions of the myth, but basically it is about a race organized by the Jade God where the first 12 animals to win will be included in the zodiac.
The zodiac is very much like horoscopes, they go in a cycle. The 12 animals cronologicaly are mouse(rat), ox(cow), tiger, rabbit, dragon, snake, horse, lamb(goat), monkey, chicken, dog, pig(boar).
The animal that represented the Chinese New Year in 1991 was the sheep.
The animal that represented the Chinese New Year in 1953 was the snake.
The animal that represented the Chinese New Year in 1948 was the rat.
The animal that represented the Chinese New Year in 1975 was the rabbit.
The animal that represented the Chinese New Year in 1969 was the rooster.
The animal that represented the Chinese New Year in 1981 was the rooster.
The animal that represented the Chinese New Year in 1966 was the horse.
The animal that represented the Chinese New Year in 1940 was the dragon.
The animal that represented the Chinese New Year in 1967 is the sheep.
The animal that represented the Chinese New Year in 1971 was the pig.
The animal that represented the Chinese New Year in 2003 was the sheep.
The animal that represented the Chinese New Year in 1954 was the horse.
The animal that represented the Chinese New Year in 1992 was the monkey.
The animal that represented the Chinese New Year in 1991 was the sheep.
The animal that represented the Chinese New Year in 1966 was the horse.
The animal that represented the Chinese New Year in 1962 was the tiger.
The animal that represented the Chinese New Year in 1969 was the rooster.