Er-lang Shen may be a deified version of several semi-mythical folk heroes who help regulate China's torrential floods, dating variously from the , and dynasties. A later Buddhist source identify him as the second son of the Northern Vaishravana.
In the semi-mythical novels ''Creation of the Gods'' and ''Journey to the West'' Er-lang Shen is the nephew of the Jade Emperor. In the former he assisted the army in defeating the . In the latter, he is the offspring of a mortal and the Jade Emperor's sister.
Of the various identifications of Erlang Shen the most common is as Li Erlang, the second son of Li Bing, the engineer behind the Dujiangyan Irrigation System.
According to ''Story About Li Bing and His Son in Harnessing the Rivers'', in ''Records of Guansian'', Li Erlang assisted his father in the construction of the complex irrigation system that prevented the Min River from flooding and irrigated the Chengdu Plain. In thanks for the prosperity that this brought to them the local people elevated the father and son to gods and dedicated the Erwang Temple to their honour.
Legend states that Governor Li Bing sent his son out to discover the source of the flooding. He spent a year exploring the county without success. One day whilst sheltering in a cave he encountered a tiger which he slew and seven hunters who had witnessed this bravery agreed to join him on his quest.
The group finally came to a cottage on the outskirts of Guanxian. From within they heard the sound of an old woman crying. The woman was Grandma Wang and she told them that her grandson was to be sacrificed to an evil dragon who was the local river god. Li Erlang reported this to his father who devised a plan to capture the dragon.
The eight friends hid in the River God Temple and jumped out on the dragon when it arrived to claim its offering. The dragon fled to river pursued by Li Erlang who eventually captured it. Grandma Wang arrived with an iron chain and the dragon was secured in the pool below the Fulonguan Temple freeing the region from floods.
Another legend tells of Li Erlang suppressing a fire dragon that lived in the mountains north of Dujiangyan by climbing to the top of Mount Yulei, turning into a giant and building a dam with 66 mountains then filling it with water from Dragon Pacifying Pool.
Erlang Shen is also identified with Zhao Yu, a hermit who lived on Mount Qingcheng and was appointed by Sui Dynasty Emperor Yangdi as Governor of . Zhao Yu is said to have set forth with 1000 men to defeat a flood dragon that had been tormenting the area. Upon reaching the river Zhao Yu dived into the water with his double-edged sword and emerged holding the dragon’s head, Following his death, according to the ''Chronicle of Changshu County'', the region was once again plagued by flood and he was seen riding a white horse amidst the swirling currents. The locals built a temple enshrining Zhao Yu as the God Erlang and the floods were subdued.
Deng Xia is said to have been a general under Erlang who surpassed his predecessors in valour and defeated a flood dragon receiving the title Erlang Shen and a temple in his honour at Zhongqingli in Hangzhou.
Yang Jian , the second son of the Indian god Vaisravana Heavenly King, who lead the troops of heaven to guard the national borders is also identified as Erlang Shen in Chinese folk tales such as ''Journey to the West'' and ''Investiture of the Gods''.
Representations in Chinese culture
Journey to the West
Erlang makes an appearance near the start of the folk classic ''Journey to the West'' by Wu Cheng'en. Erlang, who is titled as being either True Lord, or Illustrious Sage, is the nephew of the Jade Emperor. Erlang made his first appearance when he had been ordered by the Jade Emperor to subdue Sun Wukong, who was to be punished for his havoc in heaven.
Throughout the course of Erlang's duel between Sun Wukong, Erlang had been the stronger adversary. After many transformations that were performed in their duel . Near the conclusion of the battle, he managed to see through Sun Wukong's disguise using his third-eye. He eventually defeated Wukong through teamwork with several other gods; Lao Tzu personally had dropped his refined golden ring that had hit Sun Wukong on the head, giving Erlang a chance to bring him down, and Erlang's dog bit him in the leg. After Sun Wukong had been captured, he and his heavenly soldiers would burn random areas of the Bloom Mountains. Erlang would once again be seen far later into the novel, in which he would assist Sun Wukong through chance by fighting against a certain ancient Dragon King and his allies.
In ''Investiture of the Gods'', Yang Jian would first appear during the time of the Diablo Brother's attack on the Western Foothills. After hearing of the situation, Yang would personally take the offensive against the brothers. During his duel against all four brothers, Yang would deliberately allow himself to be consumed by Diablo Long Life's flying mink. Following the battle, Yang Bliss would suddenly reappear before Jiang Ziya after killing the mink inside it's stomach with his many transformations. To trick the Diablo Brothers, Yang would later transform himself into Long Life's flying mink and steal Diablo Red's Havoc-Umbrella. Thus, Yang would be renowned as the true reason for Jiang Ziya's victory over the Diablo Brothers at an overall point.
Bao Lian Deng
In the tale, Lotus Lantern, Erlang had a sister known as the Holy Mother of Mount Hua. She married a mortal, Liu Yanchang, who was a scholar and had a son by the name of Chen Xiang. She was admonished by Erlang for this unlawful human-deity union and imprisoned under Mt Hua. When Chen Xiang came of age, he split the mountain with an axe to free his mother, but not before facing people who repeatedly tried to undermine his mission, most notably his own uncle Erlang.
As a filial deity
In Chinese belief he was a filial son that entered the Chinese underworld to save his deceased mother from torment and will punish unfilial children by striking them with thunder strike as a punishment, hence the Chinese parent saying "Being smitten by lightning for being unfilial and ungrateful" towards unruly children. A warring deity, he wields a ''Sān Jiān Liǎng Rèn Dāo'' and always has his faithful ''Xiàotiān quǎn'' by his side. This dog also helps him subdue evil spirits.