According to 1 Maccabees, Jerusalem was recaptured and the Temple rededicated in 164 BC.
The Maccabean Revolt began after Seleucid ruler Antiochus IV Epiphanes imposed measures that interfered with Jewish religious practice. The Temple in Jerusalem was defiled, including by the installation of a pagan altar. Judas Maccabeus and his forces eventually regained control of the city and the Temple precinct.
1 Maccabees describes the Temple being purified and its altar replaced. The rededication began on the 25th of Kislev and continued for eight days, establishing the historical foundation of Hanukkah. The date is sometimes confused with 165 BC because ancient calendars and reconstructions can be interpreted differently, but the standard dating for the event in 1 Maccabees is 164 BC.
This was a rededication of the Second Temple, not the construction of a new temple. The episode is also recounted in 2 Maccabees, though the two books differ in emphasis and detail.