The fast of the 17th of Tamuz begins a three week period of mourning. This time of mourning ends with the fast of the 9th of Av. The reason we mourn during this time is because the 17th of Tamuz marks the date on which the walls of Jerusalem were breached during the campaign that ended with the destruction of the Temple on the 9th of Av
The first temple was destroyed at the hands of Nebuchadnetzar the babylonian king. He sieged Jerusalem until its people starved as we find in Aicha (book of Jeremiah telling of Temple's destruction) "all her nation is moaning begging for food, they exchanged their precious things to keep body and soul together..." "The children who begged for food were fainting in the streets"
"The girls of Tzion would gather in the markets and see each other. One would say to the other why have you come ot the market...you never had to before. And the other would answer her, "am I hiding from you that the hunger is terrible and I can't bear it?. They would hold on to each other and beg through the city and did not find bread. In the end they leaned against the city colannades and died beneath them.
Nebuchadnetzer then attacked with his army using the catapults common at that time. The heaviest fighting took place on the temple mount and when the babylonians finally broke in they murdered thousands upon thousands of Jews in the temple itself.
The people were gathered in chains and made to walk from Jerusalem until babylon and were not allowed to stop at all on the way, lest they pray and their G-d take mercy on them.
Jermiah was the prophet at this time and G-d did not want him to witness the actual destruction of the temple so he had left to his home town before the seige and did not see Jerusalem destroyed.
As Jeremiah was heading back to the city he saw smoke rising from it. "Perhaps they have started bringing offerings again" he thought happily. But when Jermiah got closer and saw the temple smouldering he broke into tears and ran after his people placing himself in chains amongst them...
When the Jews finally reached the rivers of babylon they were allowed to rest. Nebuchadnetzer asked the levities to sing for him the songs they had sung in Jerusalem. At this the Levities cut off the tips of their fingers saying "How can we sing the song of G-d in a stranger's land.." They flung their harps up to the trees remembering Jermiah's prophecy that in seventy years they would return and perhaps there would be use for these instruments again.

The second temple was destroyed by the Romans. They too seiged Jerusalem. It is said that there were three rich men in Jerusalem who had enough oil wheat and wine to sustain the entire city for longer then the romans could last. but there were those among the Jews who wanted to fight the romans and drive them back (the baryoni) And they burned these stores hoping to force the jews thus to rise against the romans. On the seventeenth of Tamuz Titus the roman general was ready to give up and go home, he had tried with every sort of metal to break the gates to Jerusalem and failed. As he turned to go Titus threw his last ax at the gates and they opened. Thus the romans broke into the temple.
Here Titus slashed at the great curtain that seperated the holy of holies and blood came out. Titus thought he had 'killed' the Jewish G-d. So the curtain was made into a sack in which the many vessels of the temple were dragged to Rome.
The temple was burned and Titus commanded four of his generals to set fire to the walls surrounding the temple mount. One of the officers could not bring himself to do this and threw himself off the wall which remains standing to this day.