Yan Luo Wang is known by many names. He is a ghost-deity that resides in Di Yu (地狱 dì yù) - "Chinese Hell" - an ancient god of death, well known throughout China through myths and legends that have been passed down for thousands of years.
When something (human or animal) in the Earth Realm (阳间 yáng jiān) dies, part of their spirit must travel to the Shadow Realm (阴间 yīn jiān). And it is in the Shadow Realm that the spirit will enter Di Yu to be judged in accordance with their earthly sins.
In Daoism, Di Yu is made up of 10 Courts. Each Court is governed by a Ruler (known as a Yama) with multiple innovative torture methods at hand, and each Ruler passes judgement on a fixed scope of sins that can be committed in the Earth Realm. Unless a spirit is truly evil, their stay in Di Yu is not eternal, but the time spent there is no walk in the park. Spirits are tortured to 'death' then brought 'back to life' in a continuous cycle until their sentence is deemed complete and their sins atoned.
Yan Luo Wang was once the Ruler of Di Yu, he sat in the 1st Court of Di Yu and was first to pass judgement on all that entered his domain. However, one day the Jade Emperor (玉帝 yù dì) decided that Yan Luo Wang was too merciful, that his punishments were not severe enough and that thousands of spirits' sins had gone unanswered for. He demoted Yan Luo Wang to the 5th Court of Di Yu and replaced him with a much less forgiving Yama called Qin Guang Wang (秦广王 qín guǎng wáng).
His demotion is not well-known in China. As a result, most Chinese people believe that Yan Luo Wang is still the Ruler of Di Yu.