The Temple was the idea of a permanent house of worship to succeed the Tabernacle. The idea was manifested through two structures, one built by Solomon and another built by Zerubbabel. In addition the prophet Ezekiel received a vision concerning a Third Temple and its dimensions.
The Temple was always located in Jerusalem, the capital of Israel (and later Judah). After its conception by King David, many years were spent in preparation and planning of materials, logistics, and personnel. After this Solomon spent seven years to construct the First temple. It was destroyed at the fall of Jerusalem and rebuilt when the Jews returned from exile. The second Temple was improved upon during the days of Herod the Great of Judea, and destroyed along with most of Jerusalem in AD 70.
The primary purpose of the Temple was to serve as a permanent facility to perform rituals according to the law . It replaced  the Tabernacle, as the facility in which sacrifices and in rituals were allowed  to be performed.
God "dwelled" in the Temple by being present over the Ark of the Covenant, although He did not need to do this as He does not live in temples manufactured by humans . The Temple also served as a type of the Christ  Christ, the church  and even individual believers .