Saint John Chrysostom explains to us why Christ was baptized when He had no need of it:
Hence it is evident, that He came to Jordan not for the forgiveness of sins and not for receiving the gifts of the Spirit, but so that some from those present then should not think that He came for repentance like others. Listen to how John precluded this: What he then spoke to the others then was, “Bear ye fruits worthy of repentance.” But listen to what he said to Him: “I have need to be baptised of Thee, and Thou art come to me?” (Matthew 3:8, 14). With these words he demonstrated, that Christ came to him not through that need with which people came, and that He was so far from the need to be baptised for this reason—so much more sublime and perfectly purer than Baptism itself. For whom was He baptised, if this was done not for repentance, nor for the remission of sins, nor for receiving the gifts of the Spirit? Through the other two reasons, of which the one the disciple speaks, and about the other He Himself spoke to John. Which reason of this baptism did John declare? Namely, that Christ should become known to the people, as Paul also mentions: “John therefore baptised with the baptism of repentance, so that through him they should believe on Him that cometh” (Acts 19:4). This was the consequence of the baptism. If John had gone to the home of each and, standing at the door, had spoken out for Christ and said: “He is the Son of God,” such a testimony would have been suspicious, and this deed would have been extremely perplexing. So too, if he in advocating that Christ had gone into the synagogues and witnessed to Him, this testimony of his might be suspiciously fabricated. But when all the people thronged out from all the cities to Jordan and remained on the banks of the river, and when He Himself came to be baptised and received the testimony of the Father by a voice from above and by the descent of the Spirit in the form of a dove, then the testimony of John about Him was made beyond all questioning. And since he said: “and I knew Him not” (John 1:31), his testimony put forth is trustworthy. They were kindred after the flesh between themselves, “wherefore Elizabeth, thy kinswoman, hath also conceived a son”—said the Angel to Mary about the mother of John (Luke 1: 36). If, however, the mothers were relatives, then obviously so also were their children.
Thus, since they were kinsmen, in order that it should not seem that John would testify concerning Christ because of kinship, the grace of the Spirit organised it such, that John spent all his early years in the wilderness, so that it should not seem that John had declared his testimony out of friendship or some similar reason. But John, as he was instructed of God, thus also announced about Him, wherein also he did say: “and I knew Him not.” From whence didst thou find out? “He, having sent me that sayeth to baptise with water, [is] the One [Who] did tell me” What did He tell thee? “Over Him thou shalt see the Spirit descending, like to a dove, and abiding over Him, that One is baptised by the Holy Spirit” (John 1:32-33). Dost thou see, that the Holy Spirit did not descend as in a first time then coming down upon Him, but in order to point out that preached by His inspiration—as though by a finger—it pointed Him out to all. For this reason He came to baptism.
And there is a second reason, about which He Himself spoke. What exactly is it? When John said, “I have need to be baptised of Thee, and Thou art come to me?” He answered thus: “Stay now, for thus it becometh us to fulfill every righteousness” (Matthew 3:14-15). Dost thou see the meekness of the servant? Dost thou see the humility of the Master? What does He mean, “to fulfill every righteousness?” By righteousness is meant the fulfillment of all the commandments, as is said: “both were righteous, walking faultlessly in the commandments of the Lord” (Luke 1:6). Since fulfilling this righteousness was necessary for all people—but no one of them kept it or fulfilled it—Christ came then and fulfilled this righteousness.
And what righteousness is there, someone will say, in being baptised? Obedience for a prophet was righteous. As Christ was circumcised, offered sacrifice, kept the sabbath and observed the Jewish feasts, so also He added this remaining thing, that He was obedient to having been baptised by a prophet. It was the will of God, then, that all should be baptised—about which John speaks: “He having sent me to baptise with water” (John 1:33); so also Christ: “The publicans and the people do justify God, having been baptised with the baptism of John; the pharisees and the lawyers reject the counsel of God concerning themselves, not having been baptised by him” (Luke 7:29-30). Thus, if obedience to God constitutes righteousness, and God sent John to baptise the nation, then Christ has also fulfilled this along with all the other commandments.
Consider, that the commandments of the law are the main point of the two denarii. Our race needed to pay this debt; but we did not pay it, and we, falling under such an accusation, were embraced by death. Christ came, and finding us afflicted by it, paid the debt, fulfilled the necessary and seized from it those who were not able to pay. Wherefore He does not say: “It is necessary for us to do this or that,” but rather “to fulfill every righteousness.” “It is for Me, being the Master,” says He, “proper to make payment for the needy.” Such was the reason for His baptism—wherefore they should see that He had fulfilled all the law—both this reason and also that, about which was spoken of before. Wherefore also the Spirit descended as a dove, because where there is reconciliation with God—there also is the dove. So also in the ark of Noah the dove brought the branch of olive—a sign of God’s love of mankind and of the cessation of the flood. And now in the form of a dove, and not in a body—this particularly deserves to be noted—the Spirit descended, announcing the universal mercy of God and showing with it, that the spiritual man needs to be gentle, simple and innocent, as Christ also says: “Except ye be converted and become as children, ye shalt not enter into the Heavenly Kingdom” (Matthew 18:3). But that ark, after the cessation of the flood, remained upon the earth; this ark, after the cessation of wrath, is taken to heaven, and now this Immaculate and Imperishable Body is situated at the right hand of the Father.