Naruto and Sasuke were fighting at the valley of the end and Sasuke stabed Narutos Heart but Naruto doesn't fully die he stays as a "Ghost" and watches everything that happens after he dies. He sees something unfold and he gets torn apart and sent over the edge and SNAPS and temporarily comes back to kill the Villagers that made him snap.