Zhong Kui 鍾馗, seldomly written 鍾葵, is a person figuring in Chinese tales and stories as a fighter against demons and evil spirits. He is therefore usually called "the demon queller".
In his book Bu mengqi bitan 補夢溪筆談 the Song period 宋 (960-1279) scholar Shen Kuo (1031-1095) writes that the Tang period 唐 (618-907) court painter Wu Daozi 吳道子 once created a painting of Zhong Kui. Emperor Xuanzong 唐玄宗 (r. 712-755) then dreamt of two ghosts, the larger of them being Zhong Kui, who explained to the emperor that he had failed in the military examination but had vowed to defend the emperor against evil ghosts. The painter was highly rewarded for having created such a helpful figure.
The history of Zhong Kui was already discussed in earlier times. In Zhao Yi's 趙翼 (1727-1814) book Gaiyu congkao 陔餘叢考 it is said that the word zhongkui 終葵, a kind of flower, was the origin for the name of Zhong Kui. Ma Rong 馬融 (79-166 CE), a Han period 漢 (206 BCE-220 CE) scholar, says that those wanting to dispel ghosts waved the zhongkui and swung a jade axe or a hammer. The herb zhongkui thus served to protect against evil ghosts, and the term was later interpreted as the name of a person. This happened at an early point of time so that the original herb was soon forgotten and Zhong Kui always imagined as a person dispelling demons. Even the characters were changed, Zhong written with the common family name Zhong 鍾.
Personal names of the Northern Wei and the Sui periods like Li Zhongkui 李鍾馗, Qiao Zhongkui 喬鍾馗 and Yang Zhongkui 楊鍾馗 demonstrate that the word zhongkui was, in the known characters, widely in use during the 6th century CE.
There are a lot of stories about Zhong Kui, and even novellas were created, such as Zhanguizhuan 斬鬼傳 "Beheading the ghosts", Pingguizhuan 平鬼傳 "Pacifying the demons" or Zhong Kui jia mei 鍾馗嫁妹 "Zhong Kui weds his sister" (or 鍾馗嫁魅 "Zhong Kui's ghost wedding").
In Daoism Zhong Gui was elevated to a celestial deity with the function of chasing away evil spirits. Together with Zhang Guolao 張果老, one of the Eight Immortals 八仙, he participated in the creation of the dark and the light in the shape of two bats (bianfu 蝙蝠). Since the 9th century it became custom to hang up a picture of Zhong Kui at New Year's Eve that has, like firecrackers, the power to fend off evil spirits. Today, this custom is common during the Dragon Boat Festival.