Overview
Like Zhu Bajie, Wujing was originally a general in Heaven, more specifically a Curtain-Lifting General.(卷帘大将 juǎnlián dàjiàng) In a fit of rage, he destroyed a valuable vase. Other sources mention that he did this unintentionally, and in the Journey to the West series, it was an accident. Nevertheless, he was punished by the Jade Emperor, who had him struck 800 times with a rod and exiled to earth, where he was to be reincarnated as a terrible man-eating sand demon. There, he lived in the Liúshā-hé (流沙河, Lưu Sa Hà in Han-Vietnamese, "flowing-sand river", or "quicksand-river", modern name Kaidu River). Every day, seven flying swords sent from heaven would stab him in the chest before flying off as a punishment to him. As a result, he had to live in the river to avoid the punishment.
Wujing's appearance was rather grisly; he had a red beard and his head was partially bald; a necklace consisting of skulls made him even more terrible. He still carried the weapon he had in Heaven, a yuèyáchǎn, a double-headed staff with a crescent-moon (yuèyá) blade at one end and a spade (chǎn) at the other, with six xīzhàng rings in the shovel part to denote its religious association. There is an interesting story about the necklace of skulls: An earlier group of nine monks on a pilgrimage west to fetch the scriptures met their end at the hands of Wujing. Despite their pleas for mercy, he devoured them, sucked the marrow from their bones, and threw their skulls into the river. However, unlike his other victims whose bone sank to the river bottom, the skulls of the monks floated. This fascinated and delighted Wujing, who strung them on a rope and played with them whenever he was bored.
Later, Guanyin, the Bodhisattva of compassion, and her disciple Prince Moksa came searching for powerful bodyguards in preparation of Xuanzang's journey west. She recruited Wujing in exchange for some relief from his suffering. She then converted him and gave him his current name, Shā Wùjìng. His surname Shā ("sand") was taken from his river-home, while his Buddhist name Wùjìng means "awakened to purity" or "aware of purity". Finally, he was instructed to wait for a monk who would call for him. When Wujing does meet Xuanzang, he was mistaken for an enemy and attacked by Sun Wukong and Zhu Bajie. Guanyin was forced to intervene for the sake of the journey.
After everything was cleared up, Wujing became the third disciple of Xuanzang, who called him Shā-héshàng (沙和尚, i.e. the "sand priest"; a héshàng is a Buddhist monk or priest in charge of a temple; in Japanese, oshō). Now, he was clad in a Buddhist pilgrim's robe and his skull-necklace was turned into a monk's one. His appearance also changed; from now on he looked more like a human, yet still ugly. During the Journey to the West, his swimming ability was quite useful. He always carried a small gourd which he could turn into a huge one to cross rivers. Wujing was actually a kind-hearted and obedient person and was very loyal to his master, among the three he was likely the most polite and the most logical. At the journey's end, Buddha transformed him into an arhat or luohan known as the Golden-bodied Arhat (金身羅漢, Chinese: Jinshēn Luóhàn).
As the third disciple, even though his fighting skills are not as great as that of Wukong or Bajie, he is still a great warrior protecting Xuanzang and can use his intellect as well as his strength to beat the enemy. He knows only 18 forms of transformation and admits this as reported in the middle of the narrative.
Read more about this topic: Sha Wujing