In Japanese mythology and folklore, Tenjin (天神?) is the Shinto kami of scholarship, the deification of a scholar, poet, and politician named Sugawara no Michizane. Ten 天 means sky and jin 神 means god or deity. The original meaning of Tenjin, sky deity, is almost the same as that of Raijin (a god of thunder).
In Japanese history, Sugawara no Michizane rose high in the government of the country in the late 9th century, but at the beginning of the 10th century he fell victim to the plots of a rival, a member of the Fujiwara family, and was demoted and exiled to Kyushu. He died in exile in 903. Immediately afterwards, the capital city was struck by heavy rain and lightning, and many of the leading Fujiwara died, while fires caused by lightning and floods destroyed many of their residences. The court of the emperor drew the conclusion that the disturbances were caused by Michizane's angry spirit, and, to placate it, the emperor restored all Michizane's offices, burned the official order of exile, and ordered that the poet be worshipped under the name Tenjin, which means sky deity. A shrine was established at Kitano; it was immediately raised to the first rank of official shrines, supported directly by the government.
For the first few centuries, then, Tenjin was seen as a god of natural disasters, worshipped to placate him and avoid his curses. However, Michizane was a famous poet and scholar in his lifetime, one of the greatest of the Heian Period, and in the Edo Period scholars and educators came to regard him as a patron of scholarship. By the present day, this view has completely eclipsed natural disasters in popular worship. Tenjin's influence is now regarded as particularly strong in passing exams, and so many school students, and their parents, pray for success at his shrine before important entrance exams, and return afterwards, if appropriate, to give thanks for success.