In the "age of fairy tales", the World was whole and full of light, which was believed to come from Kingdom Hearts, which was protected by its counterpart, the χ-blade. Over time, people came to desire the power of Kingdom Hearts, introducing darkness into the World.
In order to take control of Kingdom Hearts, many people forged Keyblades in the image of the χ-blade, and they clashed together in a far-reaching conflict that embroiled the entire World. In the end, darkness covered the World, the χ-blade was shattered into twenty pieces, seven of pure light and thirteen of pure darkness, and the "true" Kingdom Hearts disappeared into the darkness.
However, the World was restored by the light within the hearts of children, but as many individual worlds separated from each other. The remnants of the battlefield on which the Great Keyblade War took place became the Keyblade Graveyard, a scarred wasteland filled with the Keyblades of fallen warriors. The remaining Keyblade wielders resolved to protect the World from further destruction, becoming guardians of the World order.
The story of the Keyblade War was passed into legend, and the Keyblade was depicted both as a bringer of chaos and destruction and as a weapon to save the World.
However, during the war there was a mysterious group who watched over the Great Keyblade War only to be known for their wisdom and hearts pure than any else, these people were known as the Twenty-Six Keys founded by the first Keyblader of Light, Grandmaster Lei Hong. During the beginning of the war, Grandmaster Lei Hong thought of a way to become immortal but wishes to die when the war will hopefully comes to an end. He successfully figured it out by staying in both the Realms of Lights and Darkness, however he soon discovered that the Great Keyblade War had gone completely out of hand and knew he cannot end it alone so he decided to find twenty-five worthy Keyblade wielders to help him at such hard times. Throughout the years he searched and found the most honorable warriors and formed the Twenty-Six Keys, they remained in the realms until they figured out a way to finally put the war at rest for good.
In the war's final moments Lei Hong along with the rest of the Twenty-Six Keys knew they'll going to die very soon due to living past their timing. Felice Calandrino, one of the most loyal members believed the Great Keyblade War will return but might cause the end of Kingdom Hearts. So he decided that if they would use their Keyblades to release their hearts into various worlds where they'll reside, those said heart will find someone worthy enough can become their successor and incarnation. Lei agrees with this idea and perform it along with the others causing the end of the original Twenty-Six Keys.