Sign of the Cross
The first certain evidence we have of the use of this sign is from the ecclesiastical writer Tertullian (230 AD) who tells us that candidates for baptism are marked with a sign of the cross on their foreheads during the course of their catechumenate (formation). This doesn't mean that it was not made earlier, since as I will show it has very Jewish roots.
The Jews of Jesus' time (and orthodox Jews still do this) had the practice of wearing certain Scripture texts in a little box on their arms and on their foreheads. They got the idea from several passages in the Law, in particular Deut. 6:4-8:
"Hear, O Israel! The LORD our God is one. Therefore, you shall love the LORD, your God, with all your heart, and with all your soul, and with all your strength. Take to heart these words which I enjoin on you today. Drill them into your children. Speak of them at home and abroad, whether you are busy or at rest. Bind them at your wrist as a sign and let them be as a pendant on your forehead."
In this passage the first verse (the "Shema Israel") is tantamount to Judaism's Creed - the Lord is one. This basic truth of one God who is Lord of Israel set the People of the Old Covenant apart from the unbelieving "nations" or Gentiles.
Later in history God will say, "Pass through the city (through Jerusalem) and put a mark on the foreheads of those who moan and groan over all the abominations that are practiced within it" (Ezekiel 9:4). Here Ezekiel is speaking of the remnant of the people of God who remain faithful, to set them apart from the unfaithful. The Hebrew word for mark is the same as for the last letter of the alphabet, Tav, which in hand-written form is cross-shaped. It was used in the ancient world to brand animals. In Greek this is Tau, T, one of the possible shapes of Jesus' actual cross.
In the book of Revelation the servants of the Antichrist are to have their own peculiar mark (Rev. 14:9) to indicate their belonging to him.
So, as Jews wore their sign of belief in God, as the supporters of the Antichrist will wear his mark, it is fitting that the followers of Christ wear His mark, as the true remnant of the people of God. This mark is preeminently the baptismal conformation to Christ, but the Sign of the Cross is a fitting reminder since it expresses belief in the principle Christian truths, the Trinity, Christ and the Cross which won our salvation. As St. Paul says in 1 Cor. 1:23-24, "we proclaim Christ crucified, a stumbling block to Jews and foolishness to Gentiles, [24] but to those who are called, Jews and Greeks alike, Christ the power of God and the wisdom of God."
As for the practice of making the Sign of the Cross when passing a Catholic Church, this is in lieu of a genuflection which one would make if one entered the church into the Real Presence. Since Protestant churches do not have the Real Presence it would be inappropriate to sign oneself when passing them.