Jesus said, I have no reason to be baptized. He has not committed any sin. So, why did he need to be baptized? The reason he has said to be baptized by John is because he said, when John asked him, are you coming to me to be baptized? Am I the one who has the need to be baptized? Jesus answered, this is our duty to fulfill all righteous things. Sometimes it might not be according to what is expected, but we have to accept it or do it because the responsibility is upon us to fulfill it.
You can say that Jesus Christ being baptized was to fulfill what is expected because he came into this world to do the will. So, his baptism was one of the ways of fulfilling the purpose of God.
Jesus Christ was saying that he had submitted himself to be baptized. He did that to lead us as an example. This has made baptism a necessity for you followers. So, Jesus Christ himself was baptized. So, we all should also be baptized. It is a call to everyone who is a disciple of Jesus Christ to be baptized in the Spirit.