After the destruction (churban) of the First Temple, the prophets instituted fasts in commemoration of the tragic events surrounding the churban and the exile of the Jews [from their Land]. The purpose of these fasts is to arouse the people to mourn over the churban and the exile, which will lead them to repent and rectify the evil deeds that caused all the troubles that Israel has experienced since then, until this very day.
They instituted a fast on the tenth of Tevet because that is when Nevuchadnetzar, King of Babylonia, began his siege on Jerusalem. They also instituted a fast in Tammuz because the walls of Jerusalem were breached in that month. The ninth of Av was established as a fast day because the Temple was destroyed on that day. On the third of Tishrei, Gedalyah son of Achikam – leader of the Jews who remained in Judea after the churban – was murdered, prompting [the prophets] to institute a fast day, because his death extinguished the last ember of Jewish sovereignty in the Land.
The Jews observed these fasts throughout the seventy-year Babylonian exile, and when they were privileged to build the Second Temple, the question arose: are we obligated to continue fasting on these days? The prophet Zecharyah (8:19) answered, Thus says the Lord of Hosts, “The fast of the fourth [month] (Tammuz), the fast of the fifth (the ninth of Av), the fast of the seventh (the third of Tishrei), and the fast of the tenth (the tenth of Tevet) will be to the House of Judah for joy and for gladness, and for festive days; love truth and peace.” Indeed, during the Second Temple era, these days became joyous festivals.
When the Second Temple was destroyed, the [original] enactment was reinstated and the Jews [once again] observed the four fasts. However, the date of one of the fasts changed: the one in Tammuz, commemorating the breaching of Jerusalem. You see, at the time of the first destruction, the city was breached on the ninth of Tammuz, and the Jews fasted on that day throughout the seventy-year Babylonian exile. During the second churban, however, Jerusalem was breached on the seventeenth of Tammuz, on which we fast to this very day. Now, the four fasts were originally instituted, by the prophets, to commemorate the destruction of the First Temple. This is why we fast on the tenth of Tevet, which is when Nevuchadnetzar, King of Babylonia, laid siege to Jerusalem at the time of the first churban. This is also why we observe the Fast of Gedalyah, which marks the demise of Jewish governance [in the Holy Land] at the end of the First Temple era. Nonetheless, when it comes to the fast commemorating the breaching of Jerusalem’s walls, [the Sages] established the fast on the seventeenth of Tammuz, which is when the city was breached at the time of the second churban, because the pain of that destruction is closer to us. Furthermore, the verse calls that fast The fast of the fourth[month], implying that the main institution is that it should take place in the fourth month, which is Tammuz. Therefore, even when [the later sages] changed the date from the ninth to the seventeenth, they did not essentially change the prophets’ directive to fast in the fourth month in memory of the breaching of Jerusalem. Nothing changed in regards to the ninth of Av, because both Temples were destroyed on that day.
. The Tashbetz (2:271) explains at length that the prophets instituted the [four] fasts mainly in commemoration of, and as a result of, the first destruction, which is when the Shechinah (Divine Presence) left [the Jews]. The sages who lived after the second destruction did not alter the original enactment, the proof being that they did not establish a fast on the day the Romans began their war on Jerusalem. The fact that we fast on the seventeenth of Tammuz, as opposed to the ninth, is because the [original] institution of a fast day commemorating the breaching of Jerusalem referred to the month of Tammuz. Therefore, it may be moved [from the ninth] to the seventeenth. The Ramban writes in Torat HaAdam (p. 243, Chavel edition) that we fast on the seventeenth of Tammuz because the second destruction is more painful for us (based on Yoma 9b). The Yerushalmi (Ta’anit 4:5) quotes R. Tanchum son of Chanila’i as saying that, in truth, Jerusalem was breached on the seventeenth of Tammuz during the First Temple period, as well. The people simply miscalculated, thinking that the breach occurred on the ninth; and Scriptures (Yirmiyah 39:2, 52:6) did not want to deviate from what the people thought. However, Rava states in the Bavli (Ta’anit 28b) that at the time of the First Temple, the city was indeed breached on the ninth of Tammuz, while [the same tragic event took place] on the seventeenth of Tammuz in the Second Temple era. Tosafot (Rosh HaShanah 18b, s.v. zeh) write that the Bavli and the Yerushalmi dispute the matter.