Lord Yama's identity
According to Theravāda perspective, Lord Yama is considered to be a vemānika-asura who sometimes enjoys all the pleasures of heaven, in a celestial mansion and at other times experiences the fruits of his kamma by being the king in hell (niraya). Lord Yama belongs to the Cātummahārājikā deva (god) category. So according to my knowledge, lord Yama and lord Suyama of Yama are two devas.
When sentient beings appear near the hell gates, hell-wardens (nirayapalas) seizing them by the arms present them to king Yama. According to &quot;Devaduta Sutta: The Deva Messengers&quot;, he always try to remember the good deeds one did in his/her previous existence. He does not order hell-wardens to punish the sentient beings in the hell. So, he is a good king.
For more information please read this.
Note: This is what I understood. I may be wrong but not Dhamma.