The Jews believed Jesus was a forerunner to Messiah, but Peter has no such ideas. Early on they had heard this claim. Sometimes they believed and sometimes they seemed to have doubts. Yet, the more they listened to Him and watched Him, the more convinced they became. Their faith was now undeniable.
Faith is like that.
It grows as we learn. Peter and all the disciples were blessed by this confession. Jesus emphasized Peter's human inability when He referred to Him by His family name as Simon the son of Jonah or John. Man left to himself will never believe on Jesus. No, they didn't deduce this greatest fact of history on their own.