In I Chronicles 17, David wants to build God a Temple, but God says no. God says that David’s son would do this instead. God then goes to to affirm that God will build David a house, an everlasting dynasty.
Why did God not want David to build him a house? There are a variety of explanations within the Hebrew Bible. One is that God’s custom was never to dwell in a house, but in a tent and a Tabernacle. We see this idea in II Samuel 7:5-7 and I Chronicles 17:4-6. Another is that David had shed much blood in warfare. This notion is in I Chronicles 22:8. A third explanation is that David was too busy fighting wars to devote the time necessary to building a Temple. We see this in I Kings 5:3, and I would say that this explanation is also implied in II Samuel 7 and I Chronicles 17. Both of these chapters stress that God will bring Israel to a state of security, implying that it was not fully present when David wanted to build the Temple. And, sure enough, in subsequent chapters, David still has more wars to fight. Better to save the building of the Temple for a peaceful time!
The third explanation for why David wanted to build the Temple makes practical sense: it was just not the right time yet. The first two explanations are, well, kind of nebulous, in my opinion. Why did God prefer to dwell in a Tabernacle? Was it because God was humble? Did a person put those words into God’s mouth to attack the establishment or to promote a simpler form of worship, rather than a grand Temple? Was God somehow suggesting that any Temple David could build for God would not be good enough for God, and that was why God rejected a Temple for so many years? There are commentators who maintain that God was putting David in his place: David had an ambition to build his god a Temple, since that is what kings do, and God told David that the Temple would be built when God wanted it, not when David wanted it (Jewish Study Bible).
Why did God in I Chronicles 22:8 say that David could not build God a Temple on account of all of the blood he has shed? Did not David shed this blood in wars that God had sanctioned: wars against Israel’s enemies that were designed to bring Israel security? Was God saying that wars in those cases were a necessary evil? Did God prefer that the Temple be built when Israel had a fresh start of peace, in David’s son Solomon?
One professor told me that the biblical text in these cases is trying to account for why David did not build a Temple, when kings ordinarily built their gods Temples. That would arguably support the existence of a historical David, unless one wants to suggest that biblical authors still could have made David up and presented God’s refusal of David’s request in order to teach some moral lesson, or to attack later political realities under the guise of criticizing David.
In any case, there are spiritual lessons that I can take from this: how my timing may not be God’s timing, for example.