When David determined to build God a house, God said something back. We find this story in II Samuel 7.
First, the Lord gently criticizes David for taking it on himself to create a worship innovation that the Lord had not commanded. The Lord questions David's presumption that he is the right one to build God a house (7:5). The Lord points out that God did command a traveling tabernacle, with which the Lord has been perfectly content (7:6). Then He points out that He had not commanded anyone to build Him a house (7:7). So even though David's basic motive was good, it was mixed with presumption.
Then the Lord points out that is He who does things for Israel and David, not David for him (7:8-11). God didn't want a house. Instead, He announced that He would build David a house -- a line of royal descendants. God promised to make one of Davids sons the king. God would establish him as king, and that man would build God a house (7:12-13). We know that man to be Solomon.
God promised to be Solomon's father. The Lord would discipline Solomon using the stick of human affliction (7:14). But in spite of Solomon's sins, God would not withdraw His lovingkindness from him the way God did from Saul. Unlike Saul, David's line and David's kingdom would endure forever (7:15-16).
This is why the Messiah was called the "son of David." The Messiah would be that seed of David who would reign forevermore. This is especially taught in the prophecies of Isaiah. We know that man to be Jesus of Nazareth.
Jesus is God's prophet, and God's priest, but He is also God's king. We need to think of Jesus as our king, not just as our savior. Jesus' bloodline traces back to David, and qualifies Him to be God's king. His lineage to David helps us know He is the true Messiah. Because Jesus rose from the grave, He reigns as David's royal son continually, without end. This is biblical covenant number 4.