Let’s clear up a common misconception.
It is sometimes alleged that, on the day Jesus was crucified, that the dead left their graves and walked amongst the people of Jerusalem. Sometimes it’s even said that these were ghosts moving about the city. On the latter point there is no debate: The Bible does not say anything about ghosts roaming Jerusalem, not then or any other time.
As to the other point, the writer Matthew does have this to say…
Jesus, when he had cried again with a loud voice, yielded up the ghost. And, behold, the veil of the temple was rent in twain from the top to the bottom; and the earth did quake, and the rocks rent; And the graves were opened; and many bodies of the saints which slept arose, And came out of the graves after his resurrection, and went into the holy city, and appeared unto many.
(Matthew 27:50-53 KJV)
Somehow a critical line in that quote has been overlooked, causing the misinformation. Let’s break down text and notice the three big things that happened in the moment Jesus died…
First, there was an earthquake that struck the area.
Second, as a result of the first, the veil within the Temple, which separated the Holy Place from the Most Holy Place, ripped. Now you might want to attribute the second happening to the first, but this was not an ordinary earthquake, and what happened to the veil was not ordinary either: It ripped from top to bottom, which is impossible if it was simply caused by the earth under the Temple becoming unsettled.
The third thing that happened, which only Matthew recorded, was the opening of the graves. It’s here where things get fuzzy for some people and it’s all in the way Matthew presents the material. The inspired writer records the total event even though what actually happened took days to fully develop.
As a result of the earthquake, the stones which kept the dead sealed were disturbed, opening the graves. However, life did not return to the dead on the day Jesus died. Matthew very specifically says the bodies came out of the graves “after His resurrection,” at which point the dead “appeared unto many.”
When Jesus rose, so too did many others.
This point is often overlooked with many claiming resurrected people were roaming the streets of Jerusalem right after Jesus died. That’s not what Matthew says. He mentions the graves opening (due to the earthquake) and then tells us why that’s important: The dead will (when Jesus rises) come out of them.
Of course, none of that answers the question that is even more curious: WHY did the dead come out of their graves? We know why Jesus did; why did the others of Jerusalem?
I dunno, I’ll have to ask Jesus when I see Him.