Marine Admiral Z developed a hatred for pirates when his wife and son were killed. He transferred to being an instructor, where he had educated and trained many promising recruits, leaving a very positive impression on many of the future generation. However, 23 years after his family's death, his entire division of new recruits were destroyed by a particularly powerful pirate, who also cut off Z's right arm. Despite Ain and Binz survived alongside their mentor, Z's hatred for pirates only intensified.
One year after the Summit War of Marineford, the pirate who destroyed Z's division and severed his now-replaced arm was induced into the ranks of the Shichibukai, Z became disillusioned with the Marines' hypocritical doctrine of justice, and resigned once and for all. Ain, Binz and Commodore Shuzo, all of whom are loyal to their mentor and share his loathing for pirates, resigned and followed him as well. Along with the many Shiro Kuma units they took, they formed the Neo Marines, a radical group who hunt down pirates, even captured ones, and kill them with extreme prejudice.
The Neo Marines' ultimate plan is the Grand Reboot, which is to destroy the three Endpoints of the New World. This requires the usage of the Dyna Stones, weapons of enormous destructive potential that can ensure the three locations' annihilation. By doing so, this will release the huge volume of subterranean magma sealed within, enough to drown the entire world in a wave of burning lava, thus wiping out the entire pirate population and utterly destroy the fabled treasure One Piece. Z knows full well that this will kill many innocent civilians that he once swore to protect, but his hatred for pirates made him believe that sacrifices are necessary to destroy all the pirates, thus a "Grand Reboot" of the world.
As the Grand Reboot requires the Dyna Stones, which are all under the custody of the Marines for safekeeping, the Neo Marines broke into Firs Island, where a Marine Base containing the said weapons is, and also happens to be first of the three Endpoints. A successful night attack led the Dyna Stones to be taken, and during the battle between Z and Admiral Borsalino, the former Marine triggered one of the Dyna Stones, causing a massive explosion that destroyed Firs Island.
Z got blown away by the resultant explosion, and fell in the path of the Straw Hat Pirates. After coming into conflict with them and Ain used her powers to revert Nami, Chopper, Robin and Brook by 12 years in age, the crew decided to intervene and challenge the Neo Marines.
Z reunited with the Neo Marines, they make their way to Secon Island, the second Endpoint. The Straw Hat Pirates made it to the island, seeking to defeat Ain to revert their victimized members back to normal, challenged the Neo Marines once more. Luffy was once again defeated by Z, who also took his signature Straw Hat as a way to mock the pirates he hate so much. The Dyna Stones that the Neo Marines planted near the volcano exploded, destroying the second Endpoint. However, with the intervention of the now-resigned Admiral Kuzan, the citizens managed to escape the catastrophic eruption.
Kuzan met up with the Straw Hat Pirates, to explain about the Grand Reboot and the consequences it would bring onto the innocent civilians. This prompted them to make their way to the third Endpoint, Piriodo, to stop Z once and for all. Kuzan later meet up with Z, and though refusing to fight with his former mentor, they shared their thoughts on the corruption of the World Government and shared a drink.
As the Neo Marines make their way to Piriodo and set up the remaining Dyna Stones in the volcanic area, Fleet Admiral Sakazuki sent a large group of Marines to intercept them, led by Borsalino. Simultaneously, the Straw Hat Pirates made it to the final Endpoint, so Luffy can retrieve his hat and revert his crew members back to their rightful forms. They were stalled by Shiro Kuma and Borsalino's squadron, but managed to plow through and Luffy set off to challenge Z in a final confrontation. Z had placed the hat on top of one of the Dyna Stone canisters, and sat waiting in the crater in preparation to end everything.
After a grueling fight, Luffy managed to defeat Z. Interestingly, Z has known that his plan would fail despite his attitude and determination, but was glad that he managed to progress this far. He came to his senses with the persuasive power of the young pirate, and decided to give the Straw Hat Pirates and his own subordinates time to escape while holding off Borsalino's entire squadron. Kuzan, who came along to the battlefield to witness everything to the very end, froze all the Dyna Stones to prevent them from detonating, thus stopping the Grand Reboot, while also creating an ice wall to give his mentor the privacy of a final battle. Z died in battle against his many former students.