Because God told John to, to expose the Messiah.
John 1:25-34
King James Version (KJV)
25And they asked him, and said unto him, Why baptizest thou then, if thou be not that Christ, nor Elias, neither that prophet?
26John answered them, saying, I baptize with water: but there standeth one among you, whom ye know not;
27He it is, who coming after me is preferred before me, whose shoe's latchet I am not worthy to unloose.
28These things were done in Bethabara beyond Jordan, where John was baptizing.
29The next day John seeth Jesus coming unto him, and saith, Behold the Lamb of God, which taketh away the sin of the world.
30This is he of whom I said, After me cometh a man which is preferred before me: for he was before me.
31And I knew him not: but that he should be made manifest to Israel, therefore am I come baptizing with water.
32And John bare record, saying, I saw the Spirit descending from heaven like a dove, and it abode upon him.
33And I knew him not: but he that sent me to baptize with water, the same said unto me, Upon whom thou shalt see the Spirit descending, and remaining on him, the same is He which baptizeth with the Holy Ghost.
34And I saw, and bare record that this is the Son of God.
Jesus said because it was the Fathers will
King James Bible
And Jesus answering said unto him, Suffer it to be so now: for thus it becometh us to fulfil all righteousness. Then he suffered him.
but: after the death, burial, and resurection, which is what the type represented had been fulfilled.
Act 1:5 For John truly baptized with water; but ye shall be baptized with the Holy Ghost not many days hence