Then when he says, He declared openly, and did not deny, John's answer is given. The Evangelist twice mentioned that John spoke forth to show his humility; for although he was held in such high esteem among the Jews that they believed he might be the Messiah, he, on his part, usurped no honor what was not due him; indeed, he stated clearly, I am not the Messiah.
What of the statement, He declared openly, and did not deny? For it seems that he did deny, because he said that he was not the Messiah. It must be answered that he did not deny the truth, for he said he was not the Messiah; otherwise... he would have denied the truth. "A very great iniquity, and a denial of the most high God" (Jb 31:28). Thus he did not deny the truth, because however great he might have been considered, he did not become proud, usurping for himself the honor of another. He stated clearly, I am not the Messiah; because in truth he was not. "He was not the light," as was said above (1:8).
Why did John answer, I am not the Messiah, since those who had been sent did not ask if he was the Messiah, but who he himself was? I answer that John directed his answer more to the mind of the questioners than to their question. And we can understand this in two ways. According to Origen, the priests and Levites came to John with a good intention. For they knew from the Scriptures, and particularly from the prophecy of Daniel, that the time for the coming of the Messiah had arrived. So, seeing John's holiness, they suspected that he might be the Messiah. So they sent to John, wishing to learn by their question, Who are you? whether John would admit that he was the Messiah. And so he directs his answer to their thoughts: I am not the Messiah.
Chrysostom, however, says that they questioned him as a stratagem. For John was related to priests, being the son of a chief priest, and he was holy. Yet, he bore witness to Christ, whose family seemed lowly; for that reason they even said, "Is not this the son of the carpenter?"; and they did not know him. So, preferring to have John as their master, not Christ, they sent to him, intending to entice him by flattery and persuade him to take this honor for himself, and to state that he was the Messiah. But John, seeing their evil intent, said, I am not the Messiah.
Source: Commentary on John