According to myth, the Jade Emperor invited 12 animals to a banquet. He said he would give honors to each animal according to its arrival time. The ox was the second animal to arrive at the banquet.
It would have been the first but the rat had hitched a ride on the ox's back and when the moment came to cross the entryway into the palace, the rat hopped off the ox and ran in the open doors first. Clever rat.