That is part of the traditional text of the Ge'ulah blessing—the blessing for redemption—that is recited every morning right after the recitation of the Shema. (This part of the blessing is edited out of Reform prayerbooks).
Tradition says that today, the seventh day of Pesach, is the anniversary of that day when God parted the waters for the Israelites and allowed the sea to come crashing down on Pharaoh's army. We've been paying for it ever since.
The rabbis of the midrash and the Talmud cringed at the thought that God would choose to murder the Egyptians in order to rescue the Israelites. According to one midrash, God shushes the angels in heaven when they cheer the destruction of the Egyptians. "My creatures are drowning," says God to the angels, "and you would sing praises to Me?"
As I look at the words of the Ge'ulah blessing tonight, though, I notice for the first time that the wording is ambiguous. Who is wicked? Who is beloved? Whose heads were covered with water? Such ambiguity cries out to be interpreted. Why couldn't the prayer just say, "You drowned the Egyptians and You saved us"? There has to be a reason.
The reason, I think, is to remind us that it could just as easily be the other way around. God does not favor Israel just because it is Israel. God does not punish Israel's enemies just because they are our enemies. That kind of easy triumphalism is exactly what the author of the blessing wants to avoid. There is no promise that Israel is the redeemed in the text, just the possibility of being the saved beloved, which exists alongside the possibility of being the wicked drowned.
"Egypt" (Mitzrayim, in Hebrew) is not just a country in the rabbinic imagination. It is the very idea of the human ego running amok with self-adoration. Mitzrayim is the place of narrowness (the word tzar, hidden within "Mitzrayim," means "narrow.") It is the place where we put on the blinders that keep our vision from expanding to include anything but ourselves. The rabbis were right to cringe. It wasn't an army of Egyptians that God chose to wipe out. It was the egotism that allows human beings to see only themselves until not one other human being is left.
The idea that we would think ourselves great because God saved us from Mitzrayim is the very opposite of the lesson intended from this story. The Ge'ulah blessing had to be written in a way that denied the self-congratulatory reading. Our joy on the seventh day of Pesach is not the product of thinking ourselves special or superior. Rather, it is the joy of humility that we experience when we realize that we are loved despite ourselves.
The seventh day of Pesach is a major festival day, a festival of humility. Unlike every other major pilgrimage festival day of the year, we recite only the short version of the hallel psalms today. We remind ourselves not to be too loud when we praise God for transforming us from slaves into free people. This day is set aside for recognizing that the deepest joy is not the joy of boasting. Rather, it is what we experience when we take off the blinders and see a world much bigger and richer than it could be if it were our invention alone.