The Torah explicitly commands: "You shall eat, be satisfied, and bless the LORD your God for the good land He has given you." This is the only post-meal blessing the Torah itself requires; all other blessings (HaMotzi before, the various pre-fruit blessings, etc.) are rabbinic additions. The Deut 8:10 verse names three conditions: eating, being satisfied, and the land. "For the good land", the original direction was specifically toward gratitude for the Land of Israel, where the wheat grew. The Sages later expanded this into the four-blessing structure.
The structure of Birkat HaMazon is one of the great architectural achievements of Jewish liturgy:
Blessing 1 (HaZan): universal scope. God feeds all flesh, all creatures, in all places. Cosmic gratitude.
Blessing 2 (HaAretz): particular scope. Israel thanks for the land that produced this specific bread. Covenantal gratitude.
Blessing 3 (Boneh Yerushalayim): future scope. The full meal is incomplete until Jerusalem is rebuilt. Eschatological hope.
Blessing 4 (HaTov v'HaMetiv): historical scope. A specific 135 CE event becomes part of the daily meal-grace. Historical consciousness.
Eating, in Jewish tradition, is supposed to engage all four dimensions: gratitude that the universe nourishes its creatures, that the land of Israel specifically did so today, that the world is incomplete until restoration, and that history is full of small mercies worth remembering. Most people who say Birkat HaMazon every day don't articulate this theology consciously, but it's all there, every meal.
The fourth blessing (HaTov v'HaMetiv) was added by the Sanhedrin of Yavneh after a specific historical moment. After the failure of the Bar Kokhba revolt against Rome (132-135 CE), the Roman emperor Hadrian initially refused to allow the Jewish dead of the city of Beitar to be buried, leaving the bodies exposed as a warning. Years later, after Hadrian's death, his successor Antoninus Pius granted permission for burial. Additionally, the bodies had miraculously not decomposed in the intervening years. The Sanhedrin marked the moment with a new blessing thanking God for two miracles: HaTov (the Good, that they did not decompose) and HaMetiv (the Doer of Good, that permission was finally given to bury them). The blessing has been said at every Jewish meal ever since.
This is one of the very few places where Jewish liturgy preserves a specific dated historical event in its standard text.