Mata Nui is a character created by LEGO for the BIONICLE storyline. He is a god-like figure revered by the Matoran people (however, he is not worshipped as a deity; as LEGO is specifically trying to avoid religious issues) (Additionally, Mata Nui was merely a creation of and a servant to the Great Beings). The Island of Mata Nui was named in his honour.
The Makuta beings, more commonly known as the Brotherhood, were Mata Nui's first creations- the Matoran were created by the Great Beings, not Mata Nui. Their purpose was to create animals for the Matoran Universe. Mata Nui was once so close to the Brotherhood of Makuta, or at least the Makuta of Metru Nui, that they were considered "brothers"; until the Makuta became corrupt. A secret organization called the Order of Mata Nui, who remain loyal to Mata Nui, now oppose the Brotherhood. Centuries ago, the Makuta of Metru Nui attacked and Mata Nui eventually fell unconscious from his injuries, which led to what is called the Great Cataclysm.
Despite being called a "Spirit", Mata Nui does have a physical body. His location is unknown, even to the Order of Mata Nui, though it is said to be "quite easy to get to" - though "the trick is knowing you've found him". It is believed that there were Matoran who lived inside his body, keeping it running, for his form is a massive robot. This was later proven true, as the entire Matoran Universe was the body of the Great Spirit. Metru Nui was his head and contained his brain and manual cockpit, the Southern Islands represented his legs, etc. Matoran laboring actually directly affected Mata Nui's health- the Matoran Civil War disrupted work for four hundred years, after which Mata Nui was extremely close to death and was only saved when an unnamed Toa sacrificed his life to heal Mata Nui using the Mask of Life.
The Kanohi Hau Mask of Shielding is often used as a symbol to represent Mata Nui. After 2006, the Mask of Life served a similar purpose.
In the ancient past, the Great Spirit Mata Nui was sent by the even more powerful Great Beings to care for all life. He came to the Matoran people and gave them the virtues of Unity, Duty, and Destiny; and he chose select members of this race to become his Toa champions. Among these Toa, the Toa Mata held special status in that their destiny was to aid the Great Spirit if some tragedy befell him. Only once did something like this come close to happening: a civil war in Metru Nui affected normal work worldwide, and this "Great Disruption" weakened Mata Nui severely; he was only saved by the timely actions of Toa Jovan and his team.
The Toa and Matoran were not the only groups to follow Mata Nui. One other was the Brotherhood of Makuta, shadow beings who originally created creatures for the good of the universe but soon expanded to become powerful guardians of the Matoran. Another was the Order of Mata Nui, a secret society that took on tasks that Toa could not; ones where a Toa's well-known reputation could hinder the mission or where the necessary actions could violate their code of honour.
Soon after his arrival, Mata Nui created six Barraki warlords to help bring order to the universe. But the Barraki became far too ambitious, eventually plotting to usurp the Great Spirit himself. The Brotherhood of Makuta somehow learned of these plans and allied with the Toa to defeat them. The Brotherhood successfully captured the Barraki and Botar, an Order member, made them vanish. But even with the Barraki's disappearance, their goal survived...
Soon, the Great Disruption in Metru Nui damaged Mata Nui's health. A team of Toa journeyed to Voya Nui to retrieve the Mask of Life. However, the Toa who used it died with fear and regret.
One powerful Makuta, the one assigned to Metru Nui, became jealous of Mata Nui's status among the Matoran, and remembering the Barraki's plot hatched a dark plan. Attacking the Great Spirit by some unknown means, Makuta sent Mata Nui into a deep slumber and tried to make the Matoran of Metru Nui forget their Great Spirit and become their savior in his place. As a result, Mata Nui can no longer maintain the universe as he once could, and the world has been decaying ever since; the numerous natural disasters that struck at the moment Mata Nui fell asleep are collectively known as the Great Cataclysm.
But while Mata Nui still clung to life, he intervened directly to make sure things could be made right. When new Toa Metru were about to be chosen by Toa Lhikan shortly before the Cataclysm, Makuta wished to influence the choices to his advantage. Knowing this, Mata Nui and his Order falsified prophesies regarding the identities of the new Toa. Makuta believed these prophesies, and influenced Lhikan to choose others to become the new Toa. But as the prophecies were fake to begin with, the "others" that Makuta influenced Lhikan to choose were in fact the true destined Toa Metru.
Mata Nui also prepared the Toa Mata, who entered Toa canisters that were supposed to bring them to an island named "Mata Nui" after the Great Spirit, where the refugees of Metru Nui were living. But the canisters malfunctioned and would finally arrive a thousand years later, when the island's six Toa stones were brought together, summoning the canisters.
Though the Toa Mata remembered nothing of their time prior to the canisters, they quickly took up the task of protecting the island's Matoran from Makuta. Through the course of their battles, they became more powerful Toa Nuva; and one of the Matoran became Takanuva, the Toa of Light, who defeated Makuta and allowed the Matoran to return to Metru Nui, completing the first task that will help reawaken the Great Spirit.
It has only recently been discovered that Mata Nui is in fact dying from the attack, and that if he dies, the universe will die with him. The Toa Nuva have been sent to the island of Voya Nui to find the Ignika Mask of Life that could heal Mata Nui. However, this was not their destiny, but that of others: six Matoran followed them determined to help, and were transformed into the Toa Inika. Following their victory over the villainous Piraka that had claimed the mask, the Inika have been tasked with retrieving the Ignika and saving Mata Nui from dying. In the meantime, the Nuva are setting aside their original mission of awakening the Great Spirit; instead preparing the world for such an awakening.
But the Piraka's interference, as well as that of evil Barraki warlords, proved to cause too many delays. The Great Spirit Mata Nui has died. But instead of the universe collapsing as shown in a vision given by the Karzahni, the Ignika began to drain life from everything in the universe.
Before he died, Matoro followed the falling island of Voya Nui to the Universe Core. There he put the Ignika on and doing so gave up his life to revive Mata Nui. Instantly, the Great Spirit was brought back from the edge of non-existence. Mata Nui is awakened. But before his "soul" is sent to his body, Makuta takes over Mata Nui's body, exiles Mata Nui in the Mask of Life and sends him to outer space. It headed towards Bara Magna. As the Mask lands, Mata Nui quickly created a body the size of a Glatorian. As he helped a wounded warrior in battle, the villagers, the Agori say that they need him to lead other glatorians to defeat the REAL enemy, the Skrall. So he lead them to defeat the evil Skrall. This can be seen in the fourth BIONICLE movie BIONICLE: The Legend Reborn.
In an alternate universe, Matoro failed to save Mata Nui's life.
Despite initial belief, it was proven in an alternate universe that the death of Mata Nui (and, as a result, the presumed destruction of the Matoran Universe) WOULD NOT, necessarily, result in the deaths of all it's inhabitants. In The Kingdom, the Toa, Turaga, and Matoran escaped out of the Matoran Universe and back to Mata Nui, and the Toa were able to use their powers to enlarge the island to hold the stream of Rahi, Skadi, Vortixx, Nynrah, and others evacuating the universe below. Only the Zyglak were completely destroyed, and even the Makuta, whose entry was barred from The Kingdom, managed to survive, proving that life was still sustainable in the universe below, although many Matora, Rahi, etc. were killed after Mata Nui's death, suggesting apocalyptic events in the robot below.