The Catechism in Questions & Answers

485. Did Jesus also have to be baptised?

It was not necessary for Jesus Christ to be baptised, nevertheless He submitted to the baptism of John the Baptist. In so doing He put Himself on the same level as sinners. He thereby showed the way in which righteousness before God can be attained (cf. Matthew 3: 15).
The baptism of John was only a baptism unto repentance. It is a reference to the sacrament of Holy Baptism with water, which is performed in the name of the triune God.

Righteousness before God: see explanation of Question 278. Repentance: see Questions 136., 651.