2 Then afterwards the Lord went up to the feast, “about the middle of the feast, and taught.” “And the Jews marvelled, saying, How knows this man letters, having never learned?” He who was in secret taught, He was speaking openly and was not restrained. For that hiding of Himself was for the sake of example; this showing Himself openly was an intimation of His power. But as He taught, “the Jews marvelled;” all indeed, so far as I think, marvelled, but all were not converted.
And why this wondering? Because all knew where He was born, where He had been brought up; they had never seen Him learning letters, but they heard Him disputing about the law, bringing forward testimonies of the law, which none could bring forward unless he had read, and none could read unless he had learned letters: and therefore they marvelled. But their marvelling was made an occasion to the Master of insinuating the truth more deeply into their minds. By reason, indeed of their wondering and words, the Lord said something profound, and worthy of being more diligently looked into and discussed. On account of which I would urge you, my beloved, to earnestness, not only in hearing for yourselves, but also in praying for us.
Source: Tractates on the Gospel of John (New Advent)