Because David was a man of war with blood on his hands.
1 Chronicles 22:7 And David said to Solomon: ":My son, as for me, it was in my mind to build a house to the name of the LORD my God: 8 but the word of the LORD came to me, saying, ‘You have shed much blood and have made great wars: you shall not build a house for My name, because you have shed much blood on the earth in My sight. 9 Behold, a son shall be born to you, who shall be a man of rest: and I will give him rest from all his enemies all around. His name shall be Solomon, for I will give peace and quietness to Israel in his days. 10 He shall build a house for My name, and he shall be My son, and I will be his Father: and I will establish the throne of his kingdom over Israel forever.’
God wouldn’t allow David to build it do to all the blood he had on his hands. He was responsible for many deaths. But the temple was to built within that geneology line. So it was David’s son that had it done. David and Solomom both sinned often until the last years of their lives. They had faith but didn’t follow it for many years. At the end they found their faith again and lived it. It was by God’s doing that He allowed Solomon to fulfill it.
King David shed too much blood for him to build a temple. Instead God allowed his son to build it because it will be built at a time of peace.
Because David fought many battles. His hands were tainted with blood. Even if you might think that his battles were justify, still – the house of God should be of peace. That is why, his son, Solomon erected the temple.
1 Kings 5:3 Thou knowest how that David my father could not build an house unto the name of the LORD his God for the wars which were about him on every side, until the LORD put them under the soles of his feet.
David had blood on his hands, it would have to be his son Soloman to build the temple.
And David said to Solomon, My son, as for me, it was in my mind to build an house unto the name of the LORD my God: 8But the word of the LORD came to me, saying, Thou hast shed blood abundantly, and hast made great wars: thou shalt not build an house unto my name, because thou hast shed much blood upon the earth in my sight. 9Behold, a son shall be born to thee, who shall be a man of rest: and I will give him rest from all his enemies round about: for his name shall be Solomon, and I will give peace and quietness unto Israel in his days. – 1 Chronicles 22: 7-9
So basically because he had been in so many battles and ended so many lives.
Mainly because he sent a man to certain death to get busy with his widow.
Because David’s bid was too high. Bertha bid lower so she built it.