To be honest, it has more to do with ancient mythology about pagan wardings, amulets, and such, than it does with Christianity. The faith actually warns against such things and calls superstition the action of the Devil, but for some reason, in it’s early days, Catholicism could not combat that pervasive idea, and so it absorbed it. It retained it even as it claimed such things weren’t godly. And no wonder why…the first meaningful conversion to the faith, and the reason that the Church ever became a dominant force, was the conversion of Emperor Constantine. He did it for many political reasons as well as his own personal beliefs, but…the myth grew surrounding his defeat of an army while carrying a relic before his forces–supposedly a piece of the true crucifixional cross of Jesus. In truth, it was likely just a piece of moldering wood, but he did it. They won, and of course, their victory was attributed to the protective powers of the piece of wood. No mention made of those who still died, despite the “protections”. Holy water has it’s origins in the ritual of baptism, which is meant to cleanse all previous sin and worldliness from the soul and make one new in the eyes of god. It’s also seen as something of a bargain between the individual and God. The cleansing property of course became synonymous with repelling evil. And there you have it.
Pagan, superstitious people’s embracing new ideas in traditional ways.