Tzom Gedaliah (Fast of Gedaliah) is an annual fast day instituted by the Jewish Sages to commemorate the assassination of Gedaliah Ben Achikam, the Governor of Israel during the days of Nebuchadnetzar King of Babylonia. As a result of Gedaliah’s death the final vestiges of Judean autonomy after the Babylonian conquest were destroyed, many thousands of Jews were slain, and the remaining Jews were driven into final exile.
The fast is observed on the day immediately following Rosh Hashanah, the third of Tishrei. In the Prophetic Writings this fast is called ‘The Fast of the Seventh’ in allusion to Tishrei, the seventh month.
— from OU.org
There have been many, many righteous people who have died. In fact, there is probably no day in the year which did not have a righteous person die on it. Does this mean that we should fast every day?
The Maharsha, who asks this question, provides the following explanation: We fast on this day not solely because Gedalya was killed. It is true that Gedalya’s death in it of itself was a tragedy, as he was righteous. However, it is because of the effect his death had – that all Jews left the land of Israel and went into exile – that we fast. We see how great of a tragedy the death of a righteous person is by the fact that the mention of this fast in the verse in Zecharia is juxtaposed with all the other fasts which commemorate the destruction of the Temple. The common denominator between the four fasts listed in the verse is the fact that the extent of the tragedy of all of them is equal, because the death of a righteous person is on par with the destruction of the Temple. Although this is true, we do not, and we practically could not, fast on every day a righteous person died.
The Maharsha continues and tells us what we are supposed to learn from the events which we are commemorating with a fast today. This murder took place in the days between Rosh HaShana and Yom Kippur – the holiest time of the year. Yishmael should have thought about what he was going to do, realized what time of the year it was, and instead of assassinating Gedalya, he should have repented. We all know that did not happen. Yishmael not only killed a person, he killed a righteous person, and caused the nation of Israel to suffer a great tragedy which we feel to this day.
We see that after the two days on which the whole nation of Israel prayed for life and a good year, we suffered a great downfall. On this day, we should truly feel troubled and worried about our devotion to Hashem. We should focus our prayers on requesting mercy from Hashem. We should not be so confident that the prayers we just completed on Rosh HaShana sufficed. We should ask from Hashem that not only should He raise us from the depths to which we have sunk after our downfalls, but He should decree a good and long life for the whole nation.
— from Torah.org