What is the logic behind the first born fasting on erev Pesach? Is it a form of celebration? If so, would not a feast be better? Is it a form of teshuva? If so, for what sin? Is it a form of thanks? If so, by what logic is a fast a form of thanks? Also, why is the fast limited to the first born? None of us alive today were personally passed over.
Wikipedia, which also lists sources, states:
The origins of the Fast of the Firstborn are found in the Talmud, and the custom may have existed even prior to Talmudic times. The primary Talmudic source quoted for this custom is found in Tractate Soferim (21:3), where it is stated that firstborns fast "in commemoration of the miracle that they were saved from the Plague of the Firstborn." Rabbeinu Asher, in his comprehensive halakhic commentary on the Babylonian Talmud (Pesachim 10:19), as well as Rabbeinu Aharon HaKohein in his Orchot Chayyim (p. 76, §13), quote the Jerusalem Talmud (Pesachim 68a) as an additional source for the fast.
Rabbi Yehuda Grunwald (Rabbi of Satmar and student of the Ketav Sofer) suggests that the firstborn Israelites fasted in trepidation in advance of the Plague of the Firstborn; despite a divine guarantee of safety, they felt a need to fast in repentance to achieve greater divine protection. Rabbi Grunwald thus posits that this was the precedent for the Fast of the Firstborn (Zichron Yehuda, vol. 1. §133).
The web last week had this reason:
Halocho #1550 - Why do the firstborns fast?
Why don't firstborns celebrate the fact that they were saved from the 10th plague - the smiting of Egyptian firstborns?
On Erev Pessach - Friday next week - all firstborns will fast in memory of them fasting in Egypt on Erev Pessach, to ensure they wouldn't be punished along with the Egyptians in the 10th plague.
I do not know a source for first borns fasting in Egypt.