Last updated: 03-11-2022
After escaping from Laozi’s furnace, Sun Wukong battles his way through heaven until the Buddha is called in to halt his rebellion. The Enlightened One makes him a wager that, if he can jump out of his hand, the macaque will become the new ruler of heaven. Monkey agrees to the wager and jumps into his palm. With one tremendous leap, Sun speeds towards the reaches of heaven, clouds whizzing by him in a blur of colors as he travels across the sky. He lands before five great pillars, thinking them to be the edge of the cosmos. He tags one of the pillars with his name and urinates at the base of another in order to prove that he had been there. Upon returning, he demands that the Buddha live up to his end of the bargain. Yet the Buddha explains that he had used his infinite powers to cloud Sun’s mind, tricking him into thinking he had left, when he actually stayed in his hand the entire time. But before Monkey can do anything, the Buddha overturns his hand, pushing it out the gates of heaven, and slamming it onto earth, transforming it into the Five Elements Mountain (Wuxing shan, 五行山). There, Sun is imprisoned for his crimes against heaven (fig. 1) (Wu & Yu, 2012, pp. 193-195).
Fig. 1 – A modern action figure of Sun Wukong’s imprisonment under a section of Five Elements Mountain (larger version).
I. The source
The idea of a primate demon being imprisoned under a mountain can be traced to a story appearing in Tang (618-907) and Song Dynasty (960-1279) sources. The first and shortest version appears in the Supplement to the History of the Empire (Guoshi bu, 國史補, early 9th-cent.):
There was a fisherman at Chuzhao 楚州 who unexpectedly hooked an ancient iron chain in the Huai [river 淮河], but could not pull it clear. He reported this to the Prefect, Li Yang 李陽, who summoned a large number of men to draw it out. At the end of the chain was a black monkey; it jumped out of the water, then plunged back and vanished. Later this was verified in the Shanhai jing 山海經, from the words—’A river-beast persistently wrought destruction.  Yu [the great 大禹] chained it below Junshan 軍山. It’s name was Wuzhiqi 無支奇 [fig. 2] (Andersen, 2001, pp. 15-16). 
Fig. 2 – A modern depiction of Wuzhiqi (larger version).
A longer and more well-known account appears in Extensive Records of the Taiping Reign (Taiping guangji, 太平廣記, 978). The entry explains how the water spirit Wuzhiqi came to wear the iron chain. The passage is quite long, so I’ll paraphrase the beginning and middle sections:
[While taking a boat (c. 797), Li Gongzuo 李公佐 of Longxi 隴西 by chance meets Yang Heng 楊衡 of Hongnong 弘農. Yang tells Li the following story.] 
In the reign period of Yongtai (765) Li Tang was governor of Chuzhou. One night, at that time, a fisherman was out fishing below Turtle Mountain [龜山], when his hook caught on something and would not come up again. The fisherman was an expert swimmer and quickly went down to a depth of fifty zhang (c. 150 meters), where he saw a great iron chain encircling the base of the mountain. He searched but could not find the end of it, and he subsequently informed Li Tang about it.
Li Tang ordered several tens of fishermen and people who could swim to get hold of the chain, but they were unable to pull it free. He increased their forces with that of fifty heads of oxen, and now the chain gave way and began little by little to move onto the shore. There was no wind at the time, but all of a sudden the waves started to roll and gush forth, and those who watched were greatly frightened. At the end of the chain a beast appeared, shaped like a monkey, with [a] white head and long mane, teeth like snow and golden claws, and it rushed onto the shore. It was more than five zhang high (c. 15 meters), and it squatted in the manner of a monkey; only it could not open its eyes, but sat motionless as if in a daze. Water ran down from its eyes and nose in a stream, and its spittle was so repellent and foul-smelling that people could not be near it. After a long while it stretched out its neck and lowered it, and suddenly opened its eyes [fig. 3]. They were as bright as lightning, and it looked at people around it, raging with madness. Those who watched took to their heels, and the beast very slowly pulled at the chain and dragged the oxen with it into the water, never to emerge again. Many knowledgeable and prominent men from Chu were present, and they looked at Li Tang and at each other, startled and fearful, not knowing the source of this. Since then the fishermen were aware of the location of the chain, but in fact the beast never appeared again.
[Li travels to Mt. Bao (Baoshan, 包山) and, with the help of the Daoist Zhou Jiaojun 周焦君, deciphers the following account found in the eighth scroll of the Classic of Peaks and Rivers (Yuedu jing, 岳瀆經).] 
When Yu regulated the waters, he went thrice to the Tongbai 桐栢 mountains, and each time a storm broke, with crashes of thunder, shattering the stones and making the trees groan. The Five Earls, Wubo 伍伯, restrained the waters, the Celestial Elder, Tianlao 天老, harnessed his troops, but they could not begin their work. In anger Yu summoned the hundred sacred powers. He searched for and called upon the Dragon Kui, Kuilong 夔龍, and the thousand spiritual lords and seniors of Mt. Tongbai bowed their heads and asked for his command. Yu then assigned Hongmeng 鴻蒙氏, Zhangshang 章商氏, Doulu 兜盧氏, and Lilou 犁婁氏, to the task, and they captured the god of the rivers Huai and Guo, whose name was Wuzhiqi 無支祁. It answered readily when spoken to and knew about the shallow and the deep parts of the Yangzi and the Huai, and about how far the marshlands extended. It was shaped like a monkey, with [a] flattened nose and high brows, black body and white head, metallic eyes and teeth like snow. Its neck stretched out to a length of a hundred feet (c. 30 meters), and its strength exceeded that of nine elephants. It attacked in high leaps and running swiftly, its movements were agile and sudden, and one could not keep it in sight or hearing for very long.
Yu turned it over to Zhanglu 章律, but he could not control it. He turned it over to Niaomuyou 鳥木由, but he could not control it. He turned it over to Gengchen 庚辰, and he could control it. For thousands of years the Chipi 鴟脾 and the Huanhu 桓胡, the tree goblins and the water spirits, the mountain sprites and the stone prodigies had roamed and roared and gathered around it, but Gengchen used his military prowess to chase them away. He tied a great chain around its neck, pierced its nose and attached a golden bell to it. He placed it under the base of Turtle Mountain at the southern bank of the Huai, so that forever after the Huai flowed peacefully into the sea. Since the time of Gengchen people would all make images of this shape in order not to suffer from the waves and rainstorms of the Huai (Andersen, 2001, pp. 17-21). 
Fig. 3 – A Japanese depiction of a Tarsier-like Wuzhiqi based on its description from the Song dynasty source (larger version).
This entry presents Wuzhiqi as a supernaturally strong monkey demon with flashing eyes and the ability to perform transformations (by stretching its neck). The gods then imprison him below a mountain to punish his affront to the natural order (calm the waves created by him). It’s no wonder then how it influenced the final novel.
Another source comes from the early Ming (14th-15th-cent.) zaju play Journey to the West (Xiyouji, 西遊記) by Yang Jingxian (杨景賢). But instead of it being the Buddha, the monkey is trapped by the Bodhisattva Guanyin, and instead of Five Elements Mountain, it is his home of Flower Fruit Mountain. Dudbridge (1970) paraphrases scene nine, titled “The Holy Buddha Defeats Sun”:
Sun Xingzhe [孫行者, Pilgrim Sun] now appears: after an initial poem vaunting his celestial birth, his ubiquity and power, he lists out the members of his ape family, alludes to his career of misdeeds and his wife, the abducted Princess of Jindingguo [金鼎國, the Golden Cauldron Country].
Devaraja Li appears, with orders to recover the possessions stolen by Sun from the Queen Mother of the West. He issues orders to his son Nezha, who enters with troops upon orders from the Jade Emperor to capture Sun Xingzhe in his home Ziyun luo dong [紫雲羅洞, Purple Cloud Cave] on Huaguoshan.
The princess-wife now enters (the singer in this act) and tells in song the story of her abduction and the life on this mountain. She is joined by Sun and they prepare to feast.
The celestial troops surround them, Sun’s animal guards flee and Sun himself escapes. Devaraja Li ‘combs the hills’ and meanwhile finds the princess, who now sings through the remainder of her suite of songs until it is decided to give her escort back to her home.
Sun Xingzhe eludes the forces of Nezha and is captured only by intervention by Guanyin, who has him imprisoned beneath Huaguoshan to await the arrival of Tripitaka, his future master (p. 195). 
The idea of the Buddha magically transforming his hand into Five Elements Mountain can be traced to a Song-era Daoist ritual in which an exorcist draws the character for “well” (jing, 井 / 丼) on the ground, thereby dividing the ritual space into nine sections, representing the Nine Palaces (jiugong, 九宮),  and in the center is placed a liquid-filled jar. After the target demons are coaxed or forced inside, the opening is sealed with paper and the exorcist performs a hand mudra representing the immense pressing weight of a mountain.  Meulenbeld (2007) writes:
The spirits captured within the grid of the Nine Palaces were kept inside their prison by symbolically pressing them down underneath a mountain. The symbolism here lies in the fact that the mountain was represented by a posture of the hand forming the character for mountain (“Mountain Mudrā” 山字訣 with the thumb, index-finger, and little finger all pointing upward [fig. 4 and 5]. Oftentimes the specific “mudrā of Mt. Tai” 泰山訣 [fig. 6], was used, representing the heaviest of all mountains. Moreover, many present-day exorcist talismans contain a character composed of a “demon” 鬼 underneath a “mountain” 山, namely the character wei 嵬 (p. 145, n. 92).
Fig. 4 – The Chinese character for mountain (shan, 山) (larger version). Fig. 5 – The Mountain mudra (shanzi jue, 山字訣) (larger version). Photo by the author. Fig. 6 – The double-handed Mount Tai mudra (Taishan jue, 泰山訣) (larger version). Original picture from here.
The “Mountain” and “Mount Tai” mudras are connected to a similar concept called the Taishan stone (taishan shi, 泰山石) (fig. 7), a class of “evil-warding stones” (shigandang, 石敢當) often placed outside of homes and temples or at the intersection of roads as protection from malevolent forces (pp. 71-72). The Taishan stone represents Mount Tai, a holy mountain in Shandong province, China, and its deity. The landmass is considered the heaviest thing imaginable in Chinese culture. This means any evil would be completely immobilized under its great weight. Therefore, this shows Five Elements Mountain serves as a cognate for Mount Tai because it is actualized in a similar manner—i.e. the landmass is represented by a hand—and its great weight is used to weigh down an evil spirit, in this case Sun Wukong.
Fig. 7 – A modern Japanese example of a Taishan stone (larger version). They often read “Taishan stone takes upon itself” (Taishan shi gandang, 泰山石敢當), denoting its duty of protection (Wang, 1992, p. 71). Original image from Wikipedia.
I recently archived the Precious Scroll of Erlang (Erlang baojuan, 二郎寳卷, 1562), a baojuan that venerates and records the various deeds of the immortal demi-god. This work states that the Monkey King was “pressed under the base of Mt. Tai” (yazai, taishan gen, 壓在太山根) (PDF page 46) (fig. 8). This supports my suggestion above that Five Elements Mountain is a cognate for Mt. Tai.
Fig. 8 – The Mt. Tai sentence is indicated in red (larger version).
1) Anderson (2001) explains that no such entry for Wuzhiqi exists in this historical bestiary (p. 16).
2) The demon Wuzhiqi is presented as a sister to Sun Wukong in a Yuan-Ming era stage play.
3) Li Gongzuo (c. 770-c. 848) was a historical story teller and the presumed author of this particular tale (Andersen, 2001, p. 16).
4) This is most likely a fictional version of the aforementioned Shanhai jing (Andersen, 2001, p. 16).
5) One such statue dating to the Song Dynasty is held in the Museum fur Ostasiatische kunst in Berlin. It is discussed at length in Anderson (2001).
6) Source slightly altered. The Wade-Giles was changed to Pinyin.
7) The nine palaces are a cosmic geographical concept in which stars are mapped according to the five Chinese cardinal directions (N, S, E, W, and center) and the four intermediate directions. Thus, they represent the universe as a whole.
8) See Meulenbeld, 2007, pp. 143-145 for more information about the jar ritual. It likely influenced media that influenced Akira Toriyama of Dragon Ball fame to create the Mafuba (魔封波; Ch: mofengbo), or “Demon Containment Wave” ritual. Padula (2016) describes the etymology and background of the Mafuba (pp. 122 to 126). He graciously provided me with a digital copy of his book.
Andersen, P. (2001). The demon chained under Turtle Mountain: The history and mythology of Chinese river spirit Wuzhiqi. Berlin: G-und-H-Verl.
Dudbridge, G. (1970). The Hsi-yu chi: A study of antecedents to the sixteenth-century Chinese novel. Cambridge: Cambridge Univ. Press.
Meulenbeld, M. R. E. (2007). Civilized demons: Ming thunder gods from ritual to literature (Doctoral dissertation). Available from ProQuest Dissertations and Theses database (UMI No: 3247802).
Wang, J. (1992). The story of stone: Intertextuality, ancient Chinese stone lore, and the stone symbolism in Dream of the red chamber, Water margin, and the journey to the west. Durham, N.C: Duke University Press.
Wu, C., & Yu, A. C. (2012). The journey to the West: Volume 1. Chicago, Illinois: University of Chicago Press.