Yirmiyahu haNavi tells us (52:6-7) that on th 9th day of the 4th month, i.e. the 9th of Tamuz, that there was a great famine in Yerushalayim and the walls were finally breached. So why do we fast on the 17th of Tamuz in commemoration of the walls being breached and not on the 9th?
1) Tosfos (R"H 18b) explains that our fast on the 17th commemorates when the walls were breached during the destruction of the second Beis haMikdash; Yirmiyahu is speaking of the events surrounding the destruction of the first Mikdash. To avoid making things too difficult (tircha d'tzibura), we fast only for the events of the second churban (Ramban).
2) The Yerushalmi explains that there was such confusion that occurred because of the destruction that Yirmiyahu recorded the wrong date.
The Magen Avraham (549:2) suggests a nafka minah between the answers. According to Tosfos, if not for the consideration of tircha d'tzibura, the 9th of Tamuz should be a fast day. Therefore, a ba'al nefesh who is able to fast should take upon him/herself to do so on that day. According to the Yerushalmi, the 9th of Tamuz has no significance; it was only Yirmiyahu's error that even caused it to get a mention.
(One could argue that even for a ba'al nefesh there is no reason to fast on 9 Tamuz. It's not that 9 Tamuz is a fast day but we all have an out because of the excuse of tircha -- rather, because it would be a tircha, there was never a takanah to fast on 9 Tamuz, only on 17 Tamuz.)
It is interesting that even according to the MG"A, it seems that a ba'al nefesh would only fast on 9 Tamuz, but the aveilus practices of the three weeks would start only on the 17th.
It's strange that according to the Yerushalmi, sefer Yirmiyahu records for posterity the wrong date on which the walls were breached. Even if Yirmiyahu erred because of the confusion of the moment, why would the sefer preserve the mistake? Why not correct it?
The Maharasha (Ta'anis 28b) learns that there is no machlokes between the Bavli and Yerushalmi. In reality, the churban even of Bayis Rishon took place on 17 Tamuz according to our calendar. However, because the enemy had taken control and changed the calendar to their count, a solar calendar instead of a lunar one, the date of destruction was fixed according to their count as 9 Tamuz (take a look at how he explains why the discrepency is only 8 days -- I don't understand it). Based on this approach, there is no error in the date of 9 Tamuz; it is correct according to the enemies calendar.
The Chasam Sofer in his derashos offers a different answer. He writes that the breach of the walls did not occur in one moment, but was a slow process. On the 9th of Tamuz, there was a small break in the walls. Had Bnei Yisrael seized this final opportunity to do teshuvah, even with the enemy already beginning to penetrate the gates of the city, Yerushalayim would have been spared. As we know, Bnei Yisrael did not do teshuvah, the walls grew weaker, the break greater, and finally on 17 Tamuz, the walls were completely breached. According to the Yerushalmi, Yirmiyahu wanted to preserve the date of 9 Tamuz when the first weaking of the walls began because it was the failure to do teshuvah on that date that was really the final straw.
The Lubavitcher Rebbe gives a similar answer and adds that we can take away from here an important lesson about the power of teshuvah. Even though the city had been under siege for over two years and time and time again Bnei Yisrael had been warned to do teshuvah or face the consequences and had not heeded the message, Hashem still did not allow the breach of the walls to go through on the 9th of Tamuz, when it was deserved, but he held the enemy back for a few more days, lest Bnei Yisrael finally return. Even at the precipice of disaster, even for those who have sqandered previous opportunities and are so very late to the game, teshuvah is still possible.