While King David wanted to build the Holy Temple, Hashem (God) told him that his son,not he, will be the one to build the Beit Hamikdash (Holy Temple). As the king who helped conquer the Land of Israel and solidify the monarchy, David played an important role in establishing the Israelites in their land. However, as a warrior, he was not able to build the actual Beit Hamikdash, which was intended to promote peace and harmony amongst the Children of Israel and the nations. In contrast to David, his son Shlomo (Solomon) was a man of peace. Therefore it was God’s choice for Shlomo to be the king of Israel to build the temple.

Source: Israel in the News