9 Peter followed him out of the prison, but he had no idea that what the angel was doing was really happening; he thought he was seeing a vision.

Read Acts 12:9 Using Other Translations

And he went out, and followed him; and wist not that it was true which was done by the angel; but thought he saw a vision.
And he went out and followed him. He did not know that what was being done by the angel was real, but thought he was seeing a vision.
So Peter left the cell, following the angel. But all the time he thought it was a vision. He didn’t realize it was actually happening.