John the Baptist, prepared the way for Jesus and taught the "baptism of repentance". This is seen in John 1:26-28:
26 John answered them saying, I baptize in water, but among you stands One whom you do not know.
27 It is He who comes after me, the thong of whose sandal I am not worthy to untie.
28 These things took place in Bethany beyond the Jordan, where John was baptizing.
John the baptist baptized Jesus after that. Matthew 3:13-17 gives us the baptism of Jesus:
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.
16 After being baptized, Jesus came up immediately from the water; and behold, the heavens were opened, and he saw the Spirit of God descending as a dove and lighting on Him, 17 and behold, a voice out of the heavens said, This is My beloved Son, in whom I am well-pleased.
Jesus began His ministry, and the disciples baptized people. After Jesus death and resurrection he told the disciples this before He ascended to heaven:
Matthew 28:18-20:
18 And Jesus came up and spoke to them, saying, All authority has been given to Me in heaven and on earth.
19 Go therefore and make disciples of all the nations, baptizing them in the name of the Father and the Son and the Holy Spirit,
20 teaching them to observe all that I commanded you; and lo, I am with you always, even to the end of the age.
That is the command to baptize. That is why churches baptize.