"Yama" is also the name of the hideous buffalo-headed ruler of the realm of hell ("naraka-gati") in Buddhist mythology.
Yama was a originally a king of Vaishali who, exulting in the death and suffering and destruction at the height of a bloody battle, wished that he were the king of hell so that he could always behold such sights and smell such a stench.
In accordance with this desire he was reborn as Yama. For whatever unexplained reason, his eight generals and eighty thousand of his followers appeared there as his, well, I suppose his staff.
Yama and his staff have molten copper poured down their throats three times a day. The rest of the time, they torment everyone else.
In the later Buddhist tantras, Yama is defeated and his powers subsumed and transformed by an incarnation of Manjusri, the bodhisattva of prajna, called Yamantaka.