The Gemara identifies Tzom Gedalya as "the fast of the seventh," the third of Tishrei, on which Gedaliah son of Achikam was murdered by Yishmael ben Netanya, and Chazal teach that the death of the righteous is equated with the burning of the Beit HaMikdash (Rosh Hashanah 18b:5), a reading echoed by the Tur (Orach Chayim 549).
The Rambam explains that Gedaliah's assassination extinguished the last remaining ember of Israel in the land, sealing the completeness of the exile (Mishneh Torah, Fasts 5:2-3), a point developed at length by Rav Eliezer Melamed (Peninei Halakhah, Zemanim 6:5), who describes how the surviving remnant's hopes of rebuilding around Gedaliah's governorship were destroyed by the murder.
Rav Eliezer Melamed further stresses that the fast was instituted not because Gedaliah personally warranted communal mourning, but because his killing snuffed out the last flicker of Jewish presence in the land after the First Temple's destruction (Rav Eliezer Melamed (Peninei Halakhah, Zemanim 4:12)).
The narrative background is drawn directly from the pesukim describing Yishmael ben Netanya's plot against Gedaliah despite warnings (Yirmiyahu 40:5-41:18), with the Abarbanel (Yirmiyahu 41:1-18) explaining that Yishmael's motive stemmed from his royal lineage and jealousy that Gedaliah, a non-royal, had been placed in charge.
The codifiers record this fast as normative practice: Shulchan Arukh, Orach Chayim 549:1-2 lists the Third of Tishrei among the four fasts obligatory because of the bad occurrences that befell Israel, and Shulchan Arukh, Orach Chayim 580:1-2 similarly lists the days on which fasting is fitting due to troubles that befell the forefathers, while Mishnah Berurah 549:1-2 and Beit Yosef, Orach Chayim 549:4 elaborate on the historical basis and the dating when the murder coincided with Rosh Hashanah.
Practical details of observance are addressed by Kitzur Shulchan Arukh Yalkut Yosef, Orach Chaim 601:3, which states that all are obligated in this fast, including a groom or one at a brit, unless the fast is postponed to the fourth of Tishrei.
Additional Talmudic and exegetical sources reinforce the day's significance: Nedarim 12a:5 cites Tzom Gedalya as a recognized reference point for a vow of fasting, and the Ibn Ezra (Zechariah 8:19) discusses how Chazal retained the fast of the seventh month among the four fasts referenced by the prophets.
Revavos Ephraim (Revavos Ephraim 6:316) holds that Tzom Gedalya is a great, awesome, and highly honored day that should be marked not through eating and drinking but by returning to God through Torah study, prayer, and supplication.
Teshuvos V'hanhagos (Teshuvos V'hanhagos 4:121) presents a machlokes over the fundamental status of Tzom Gedalya and the other minor fasts, noting that according to the Ramban they rest on prophetic tradition and can carry substantial obligation in times of distress, while according to the Rambam they are rabbinic enactments tied to mourning practice that may be relaxed when necessary.