That phrase in Psalm 118, "The stone that the builders rejected has become the chief cornerstone," was probably applied to Jesus pretty early on in Christian thought. As the first Christians began to search what we call the Old Testament to learn about Jesus, they saw many things that resonated with their experience and understanding of him.
There were the "suffering servant" passages of Isaiah. There were the lament Psalms, some lines of which Jesus himself said when he was on the cross. And there was this image of the cornerstone, rejected by the religious leadership and establishment, but used by God to build the community of faith. Jesus uses the image himself, and Peter will say it again when he confronts the Sanhedrin in Acts 4.
We know that a cornerstone is an important part of a building. Modern buildings may have one that is inscribed with the date they were built, as well as people involved in the construction or planning. In the ancient world, a cornerstone served as one of the guides in making a solid, safe structure. It needed to have properly angled faces so that the walls that were built off of it would also be at the correct angles. If the building was large, even a small deviation from a squared corner would become a serious problem as the construction extended. If it wasn't level, then the corner supports of the building wouldn't hold as much weight and would be more at risk during storms.
Measuring and preparing these kinds of stones was obviously a lot more work than it would be today. No powered grinders or saws-alls. No laser levels or precise measuring tools. All of it would be done by hand and sighted with the human eye. So many times potential cornerstones were rejected before construction began. Had they been used, some kind of building might have been built, but it wouldn't be the one the builder had in mind or the owner had paid for. It wouldn't be a safe, sturdy home, for example, but an improperly angled and potentially dangerous one.
This is the thought behind saying that the leaders of the time rejected Jesus the way a builder rejected a flawed cornerstone. Jesus, with his teachings, healings and such, would definitely have created a messianic movement among the people. But it wouldn't have been the kind of messianic movement that they wanted. He spoke of loving your enemies and praying for people who persecuted you. He talked about forgiveness and seemed to be more interested in welcoming outcasts than in casting out the unwelcome, like those stinkin' Romans.
The shouts that greeted him when he entered Jerusalem had been given before -- they had welcomed a man named Judah Maccabee when he overthrew Judea's Seleucid rulers not quite 200 years earlier. The Seleucids were the leftovers of Alexander the Great's empire who ruled at the time, and Judah was the first main leader of a revolt that would eventually throw them out of Jerusalem, Jericho and several surrounding cities. In Hebrew, his name was Yehudah HaMakabi, or "Judah the Hammer," which is a pretty darn cool name if you're a revolutionary leader. He started out as a guerilla leader, moving against people who collaborated with the Seleucids until he could win popular support for the revolt. In 164 BC, he booted the Greeks out of Jerusalem and restored Temple sacrifices.
See? That's the kind of Messiah we need, the people believed. We need someone who'll walk up to Pilate and say, "Hey! Toga Boy! I'm here to kick some tail and chew some bubble gum, and I'm all out of bubble gum, so why don't you and the rest of your miniskirt mob make like a laurel and leave!" We need someone who can get us our country back!
Perhaps that's what they thought they'd get when they welcomed Jesus with shouts of "Hosanna!" Perhaps that's the kind of Son of David they believed was among them. But when the days went by and he did nothing -- he took up no arms, he called for no revolts, he summoned no hidden armies -- their support drained away, until on Friday they would become the mob calling for his death.
But God had in mind a different kind of salvation, one that didn't depend on political leaders or fallible human abilities. God saw a much deeper human need, one that was shared not only by his chosen people, but by the Romans who ruled them and the Gentiles who lived alongside them. The earthly power the people wanted to see wielded for defense and for vengeance could not do what God knew really needed doing. Only the obedience of Christ, only his willingness to offer himself out of love for us, could address the real problem: The human weakness and human sin that separated us from the God who created us.
When we wave our palms today, we do so knowing that the king we hail is exactly that: The king of all kings and lord of lords. We see what they overlooked when they welcomed Jesus that day in Jerusalem, because his sacrifice and resurrection showed it to us. We see that with this cornerstone, rejected by others but preferred by God, a new heaven and a new earth will be made, true to the design of their Maker, and those who dwell there will know that they are truly home, and can remain there for all eternity.