Old Testament Jews washed with water before entering the Temple precincts. Building on a ritual familiar to the Jews, John the Baptist used water to represent repentance of sin and purification.
So When we cross ourselves with holy water entering and leaving the church, we recall that history. But we also refer to our Baptism when the priest used water to symbolize the washing away of our sins and to protect us from evil.