Mata Nui was an intelligent, self-aware robot created by the Great Beings to explore and observe the galaxy. His spirit was later forced into the Mask of Life and exiled from his own universe by Teridax and landed on Bara Magna, later taking over the Prototype Robot.
After many experiments and failures, the Great Beings created the Great Spirit Mata Nui on the planet of Spherus Magna. They placed him in a giant robot, which would later harbor the Matoran Universe. Mata Nui's creation was taken over by the Matoran who labored completely unaware of what they were doing. These Matoran created the Matoran Universe whose lands and species would serve as "essential functions" to him. During this time, Tren Krom maintained the universe in the heart of Mata Nui, the cavernous Karda Nui. By 100,000 years ago, Mata Nui was awakened. This was heralded by the exile of Tren Krom, who with the awakening of Mata Nui would no longer be necessary to the Matoran Universe. Meanwhile, the Great Beings created the Kanohi Ignika, a mask which could heal Mata Nui's life-force if required, and provided Artakha with the supplies needed to create the Toa Mata, whose destiny was a failsafe against the possibility of Mata Nui falling asleep. With his awakening, Mata Nui provided the Matoran Universe with light, gravity, heat, and essential forces of nature, as the Matoran would now labor as unknowingly inside his body to continue his existence. Because of this, the Matoran venerated Mata Nui, and gave him his name, Mata Nui, which was the Matoran translation for the title, Great Spirit, as well as building statues and temples in his honor. Meanwhile, in Karda Nui, the Energy Storms began, which happened as long as Mata Nui was awakened. Mata Nui was given several tasks by the Great Beings, including the observation of other worlds.
Shortly after his awakening, Mata Nui saw fit to create a new species, the Makuta. The Makuta formed the Brotherhood of Makuta, who became known as the brothers of Mata Nui and carried out his will of creating bio-mechanical Rahi and Plant Life to populate his universe. Five thousand years later, he created six species, choosing one of each to withhold order. These six became warlords known as the Barraki and allied into the League of Six Kingdoms. However, the Barraki were not entirely loyal to Mata Nui. By 15,000 years later, they had conquered the known Matoran Universe in regions, and sought the overthrow of Mata Nui himself. This action prompted the Brotherhood of Makuta and the Toa to muster an army under Makuta Teridax and capture the Barraki and end the League's rule.
500 years later, a Matoran dispute arose in Metru Nui, escalating to the Matoran Civil War. With the loss of workers, this created dire results for Mata Nui. Even when Teridax ended the conflict, Mata Nui's life was endangered. Therefore, Toa Jovan and his team were dispatched to the Southern Continent to recover the Kanohi Ignika. They took the mask underground to Karda Nui, and, with a teammate's sacrifice, healed Mata Nui.
After Mata Nui had accomplished his mission, and was returning to the now-shattered Spherus Magna, Makuta Teridax had begun to formulate a dark plan, a coup to overthrow the Great Spirit. The idea stemmed from an idea Teridax had following the Barraki's defeat, believing the League could not be the rulers of the Matoran Universe, but surely the Makuta could. After the Metru Nui Civil War, many Makuta had similar beliefs, as Makuta Miserix assigned regions for the Makuta to watch over. All over, the species became aware of complete devotion, veneration, and love for the Great Spirit, and yet none for the Makuta, despite all they had done for them. This spawned jealousy, hatred, and anger toward him, until all the Makuta just wanted to see was the Great Spirit "humbled", as Teridax described once. Therefore, when Makuta Mutran had returned from a mission to investigate Tren Krom, he informed Teridax of information such as Mata Nui's actual form and characteristics, who used the information to overthrow Miserix, and fill the Great Spirit with a virus to make him fall into a deep coma.
If Mata Nui would have ever died, the Matoran Universe would only have three days before the domes inside the Matoran Universe would fill with water with Mutagen in it, according to "The Kingdom" parallel universe. During his slumber, Mata Nui was, on some level, aware of what was going on in the universe. Before Mata Nui existed, the universe was kept in order by an entity called Tren Krom from inside Karda Nui. Mata Nui's original body was 40 million feet high, or 12,000 km high (7,575.56 miles high). His Toa-like body, however, was about 7 feet tall.