One of the jobs of the Holy Spirit is to baptize people into the Body of Christ. He does this when someone hears and believes the Gospel of Jesus Christ. The Bible authors use a few phrases to describe this event; being born again, made a new creation, going from death to life in Christ, are made new, undergo a circumcision made without hands, washed in the blood of Christ, and probably a few more.
When the Holy Spirit baptized you into the body of Christ, you are sanctified (cleansed of sin), given a new heart, and are indwelt by God’s spirit. The Holy Spirit cleanses you with the blood of Christ, which leaves you in a spiritually holy state, able to house God’s spirit. This cleansing also places you in a right state before God, he gives you the gift of righteousness.
All of this happens when the Holy Spirit baptizes you in the name of Jesus Christ, which happens when you hear and believe the Gospel.