Luke 3: Why was Jesus baptized?

Jesus' baptism in Luke 3 should give us pause. Luke's baptism was a baptism of repentence. Jesus had no sins to repent of, so why would he want to get wet? None of this is lost on his cousin John, who is very reluctant to baptize Jesus but immediatley notes that John the Baptizer should be baptized by Jesus, not the other way around. Jesus' response to him gives us our answer: "to fulfill all righteousness" (Matthew 3:3-15). John gave great pushback, but Jesus requested he permit it at this time, and John obeyed. 

Jesus came as a friend of sinners and as such identified with us. It was important for the divine Son of God to fully identify with us as He would be our sin bearer, II Corinthians 5:21. He was affirming John's authority and essentially told John, "Hey, you may not fully understand this so just work with me here. One day I will endure a horrible baptism (Luke 12:50) and you will be so glad I did. This is my first step in identifying fully with those for whom I suffer."

Praise the Lord for a Savior who fully clothed Himself in our humanity as He would baptize ("immerse") Himself in our sin and suffer so deeply for it. 

There are may side benefits of Jesus' baptism, such as His glory being revealed as a member of the Trinity. But let's stick with the primary reason, the one given by our Lord Himself.