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 Qin, Sui and Jin dynasties. A later Buddhist source identify him as the second son of the Northern Heavenly King Vaishravana.
In the Ming 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 Zhou army in defeating the Shang. In the latter, he is the offspring of a mortal and the Jade Emperor's sister.
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.
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.
His bearing was refined, his visage noble, His ears hung down to his shoulders, and his eyes shone. The hat on his head had three peaks and phoenixes flying, And his robe was of a pale goose−yellow. His boots were lined with cloth of gold; dragons coiled round his socks; His jade belt was decorated with the eight jewels, At his waist was a bow, curved like the moon, In his hand a double−edged trident. His axe had split open Peach Mountain when he rescued his mother, His bow had killed the twin phoenixes of Zongluo. Widespread was his fame for killing the Eight Bogies, And he had become one of Plum Hill's seven sages. His heart was too lofty to acknowledge his relatives in Heaven; In his pride he went back to be a god at Guanjiang. He was the Merciful and Miraculous Sage of the red city, Erlang, whose transformations were numberless.|400px|Description from Journey to the West by Wu Cheng'en
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 (Sun Wukong fleeing as a fish; Erlang and Sun Wukong becoming larger birds, and so forth). Near the conclusion of the battle, he managed to see through Sun Wukong's disguise (as a temple) 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 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 (啸天犬 - "Howling Celestial Dog") by his side. This dog also helps him subdue evil spirits.