God commands us in Acts 10:47-48 that we should be baptized.
Of course with most all of us it starts by realizing there is something missing in our life. We find a Bible or someone who wants to study the Bible with us and we begin the process of learning. Along the way we learn that the only way that we can be saved is to REPENT and BE BAPTIZED for the remission of our sins. Acts 2:38 and Acts 22:16.
We must first believe in the Bible and believe that Jesus is the Son of God. So Belief + Baptism can equal Salvation. Mark 16:16
Once we have been baptized we should walk a new life and follow His commandments. It does not automatically happen, we have to work at doing the right thing and work following His will.
Not everyone that says Lord Lord will enter the Kingdom of Heaven but because God allowed his Son (Jesus) to be crucified on the cross we are given the above opportunity to make a difference with our salvation.