The death of Mata Nui was a universe-wide event that occured roughly 1001 years after the Great Cataclysm. It was the destiny of the Toa Mahri (and in particular, Matoro) to try and prevent this event.
After returning to Metru Nui, Turaga Dume and Nuju revealed to the Toa Nuva that Mata Nui was not merely asleep; he was dying, and would die within a matter of weeks. They believed that only the legendary Kanohi Ignika, the Mask of Life, could save the Great Spirit. The Toa Nuva travelled to Voya Nui in Toa Canisters, but they were defeated and locked away by the villainous Piraka, who were also looking for the mask. The Piraka had no idea that Mata Nui was dying; they just wanted the mask for profit.
When it became clear that the Toa Nuva might not be coming back, a group of Matoran, led by Jaller, trekked to Voya Nui on foot, via Karzahni. Here they met Karzahni himself, who enslaved the Matoran and put them to work. However, the Matoran met up with an unnamed Av-Matoran, who directed them to a set of Toa canisters that he had built in the Universe Core. Karzahni caught up with the Matoran and, in an attempt to stop them, used his Kanohi Olisi to show a possible future where Mata Nui had died. Karzahni, who had previously even doubted Mata Nui's existance, was momentarily shocked and stunned by the dream, so the Matoran had a chance to escape. Once they arrived on Voya Nui, the Red Star transformed them into the Toa Inika.
With the help of the Voya Nui Resistance Team and Axonn, the Toa Inika managed to locate and find the Mask of Life, although the Piraka had got there first. The mask was attached to the head of Vezon, who promptly defeated the Piraka, only to be frozen in time and space by a special Zamor sphere fired by Jaller. Matoro, the destined carrier of the mask, removed the Kanohi from Vezon's head, although Matoro couldn't keep his grip on it and it flew away down the tunnel, before plunging beneath the waves. While the Toa Inika travelled down the Cord to follow the mask, the freed Toa Nuva were sent by Axonn and Botar to make preparations for Mata Nui's awakening.
In Mahri Nui and the Pit, the transformed Toa Mahri had to fight for the Mask of Life against the fearsome Barraki, Teridax, Hydraxon and Gadunka. However, the Toa were too late to save Mata Nui; the Ignika turned dark, symbolising his death. The universe began to flood, but Mata Nui was resurrected by Matoro, using the Ignika in the Universe Core. However, this killed Matoro in the process.