Some confusion lies in the reason of why Jesus was baptized? Some say that Jesus sinned and needed baptism as a form of repentance. Jesus sinning is completely incorrect as Jesus the God-man never sinned.
Read 1 John 3:4-5 (NASB)
4 Everyone who practices sin also practices lawlessness; and sin is lawlessness. 5 You know that He appeared in order to take away sins; and in Him, there is no sin.
Jesus explains why He needed baptism in the book of Matthew:
Read Matthew 3: 13-15 (NASB)
13 Then Jesus arrived from Galilee at the Jordan coming to John, to be baptized by him. 14 But John tried to prevent Him, saying, “I have need to be baptized by You, and do You come to me?” 15 But Jesus answering said to him, “Permit it at this time; for in this way it is fitting for us to fulfill all righteousness.” Then he permitted Him.
When Jesus used the pronoun “us” it was for all believers. Jesus also required baptism to enter legally into the Melchizedek Priesthood. He needed to by the High Priest and presented Himself as a sacrifice for all sins. Baptism was only one of the requirements for the Priesthood. First He needed to be washed with water, then anointed with oil.
Read Hebrews 5: 8-10 (NASB)
8 Although He was a Son, He learned obedience from the things which He suffered.
9 And having been made perfect, He became to all those who obey Him the source of eternal salvation,
10 being designated by God as a high priest according to the order of Melchizedek.