When John the Baptist baptized Jesus it wasn't to bring about repentance in Jesus. If that was the case then Jesus didn't need it because Jesus was sinless through out His stay here on earth. Christ was known to live a righteous life. But Christ participated in baptism so as to fulfill all righteousness. If there's anyone I know to be the best role model it is Christ Jesus.
All through Jesus' stay on earth He lived a life worthy of emulation. There are things didn't seem necessary for Him to do as God but for our sakes He humbled Himself and did it, so that even after His departure we would continue in His footsteps.
This was part of the necessary things Christ had to do so as to align with the will of God. The whole purpose of Christ coming down to earth was to do the will of His father in heaven. Jesus' journey on earth was to fulfill a prophecy. Even His coming was prophesied before time that he came to the world. Baptism was beyond just a ritual. It is us participating in the death and resurrection of our Lord Jesus Christ.
During the time of John the Baptist it was his way of preparing the people for the coming of the Lord Jesus Christ. He was setting the pace. That is why He was known as the forerunner of Jesus Christ.
I strongly believe we need Jesus to get baptised so that Jesus will not go against the law