Why did Peter deny Jesus? Was he just sitting at the wrong fire, in a crowd where he didn’t have the gumption to admit he was Jesus’ follower? That isn’t how this story works in Matthew’s Gospel.
Peter was the first to acknowledge Jesus as the Christ, God’s anointed leader (16:16). Jesus blessed him, but realized Peter had no idea of the conflict ahead. Peter’s denial began when he said, No Lord! This will never happen to you! Denying that Jesus would die at the hands of the Jerusalem leaders placed Peter on the enemy’s side (16:21-23). Peter could understand taking up his sword and kill to save his king (26:51-52), but he could not understand taking up his cross to follow the king into death to save his realm (16:24-28).
Once Jesus removed fight from the agenda, flight was the only option his followers could see. That’s why, All the disciples deserted him and fled (26:56).
Peter could make no sense of what was happening, but he couldn’t stay away either. Peter followed him from a distance … to see how it would end (26:58). That’s the reason Peter was there, trying to blend in with Jesus’ antagonists. That was never going to work, of course. A lumbering fisherman sprouting Galilean phrases was as inconspicuous as an Aston Martin in a spy movie.