If Jesus is God, then he was born without original sin. So, why did he have to be baptized?
He didn’t have to be baptized; he chose to be baptized. This is made clear in his exchange with John the Baptist:
Then Jesus came from Galilee to the Jordan to John, to be baptized by him. John would have prevented him, saying, “I need to be baptized by you, and do you come to me?” But Jesus answered him, “Let it be so now; for thus it is fitting for us to fulfil all righteousness.” Then he consented (Matt. 3:13-15).
The Baptizing of Christ by St. Thomas Aquinas