Now it came to pass, when David was dwelling in his house, that David said to Nathan the prophet, "See now, I dwell in a house of cedar, but the ark of the covenant of the LORD is under tent curtains."
1 Chronicles 17:1-15
David wanted to build a house for God—a temple. At first, the prophet, Nathan, encouraged David to do so (v.2). But that night God spoke to Nathan telling him to inform David that he must not build the temple (v.3-ff). Instead of David building a house for God, God promised to build a house for David (v.10-15).
Additionally, God foretold of a temple that would be built by David’s “seed” who would build the temple (v.11). This prophecy had two fulfillments.
First, David’s son, Solomon, did in fact build a spectacular, physical temple in Jerusalem. However, other prophecies about this Son of David, His kingdom, and the temple He would build were not fulfilled by Solomon. For example, Solomon’s kingdom was not, as prophesied, eternal (v.14).
Nathan’s prophecy about David’s Son, were fulfilled many years later by David’s greater Son, Jesus.
Jesus was a Son of David (Matthew 1:1-16). Jesus was indeed a king (John 18:36-37). Jesus promised that He would build His Church (Matthew 16:18), which is the ultimate temple of the Lord (Ephesians 2:19-22, 1 Peter 2:4-5).
The promises of the OT are all ultimately fulfilled in Christ Jesus (Galatians 3:16).