This is why both the Apostle Paul (Romans 6:1-11) and the Apostle Peter (1 Peter 3:18-21) describe baptism as taking one's prior private committment of faith and making it a public "identification" in the death, burial and resurrection of Jesus Christ. In other words, Baptism functions as an "I.D" badge that tells everyone of an internal reality that occurred prior to the baptism - namely by grace through faith that person experience death to the old life and was raised to new life. (2 Corinthians 5:17)
Baptism enables the Christian to not be ashamed
Luke 9:23-26 states: "23And He was saying to them all, “If anyone wishes to come after Me, he must deny himself, and take up his cross daily and follow Me. 24“For whoever wishes to save his life will lose it, but whoever loses his life for My sake, he is the one who will save it. 25“For what is a man profited if he gains the whole world, and loses or forfeits himself? 26“For whoever is ashamed of Me and My words, the Son of Man will be ashamed of him when He comes in His glory, and the glory of the Father and of the holy angels." Verses 23-25 speak of the commitment of faith that occurs when by grace through faith the sinner confesses Jesus as Savior and Lord. Verse 26 tells us that the true believer in Christ will want to tell everyone that they're Christ's disciple. Thus Baptism gives them that chance. This is why, especially in Baptist churches, baptism is called one's "public profession of faith".
Baptism sets the pattern before everybody that the Christian life, as much as it is entered into by faith alone, is nonetheless to be lived out with a faith that is not alone. True faith, following conversion, is characterized by works of obedience. (James 2:14-18). Jesus teaches that all those who love Him will obey His commandments. (John 14:15, 23) Conversely, those who aim to keep Christ's commandments are those who demonstrate genuine love for Him. (John 14:21) Truly then a person does not get baptized in order to become a Christian, rather they get baptized because they have already become a Christian.