The temple in Jerusalem began as an idea of King David, which he then conveyed to Nathan the prophet. After hearing David's plans, Nathan stated that God approved of what the king intended to do (2Samuel 7:1 - 3). Nathan, however, spoke a bit too soon. That night God told the prophet that King David would NOT be the one to build him a temple but that Solomon, who would rule in peace, would be the man to do the job (verses 4 - 17).
God did allow David to gather building materials for his temple in Jerusalem. As an old man, David told Solomon the reason why he could not build God's house of prayer himself. It was simply because he was a man of war, a bloody man, a man who had killed lots of people in battle (1Chronicles 22:8 - 10).
Work was begun around 966 - 965 B.C. and was completed around 959 - 958 B.C. The building was built on Mount Moriah, which is east of the city, on the spot where Isaac was offered by Abraham (Genesis 22:1-14). Unfortunately, the building was burned, pillaged and destroyed by King Nebuchadnezzar of Babylon in 586 B.C. He carried all its treasures back to Babylon.
The second (Herod's) temple in Jerusalem was built on the same location as the first. When Herod the Great was made 'king of the Jews' (king of Judea) by the Roman Senate, "God's house" had stood for roughly 500 years. It had experienced a tremendous amount of natural decay, along with the destruction that came as various armies sought to conquer the city and the temple. Herod began the work of rebuilding around 20 B.C., which was undertaken at a considerable cost of men and supplies, and on a grand scale. Work on the temple was still going on at the time of Jesus (John 2:16, John 2:19-21). It was finally completed in 65 A.D.
Sadly, only a few years after her completion, the temple was once again utterly destroyed. Roman legions stormed Jerusalem, and notwithstanding the efforts of General (later Emperor) Titus to preserve the temple, his soldiers set fire to it in several locations. The temple's total destruction began on the 9th of Ab, the same day its first destruction occurred. Its demise was completed on Ab 10, which corresponds to Sunday, August 5th in 70 A.D.