The author of Hebrews is quoting Psalm 2:7 along with 2 Samuel 7:14. These two passages have been linked together as a Messianic reference since before the time of the NT. From the ESV Study Bible notes on the text we can see how to view these two references in regards to David and the Messiah:
In the context of Samuel, the reader might assume this refers to
David’s son Solomon, but Solomon failed to follow the law and was not
“established forever” (2 Sam. 7:16); hence, the promise can only be
fulfilled by the Davidic Messiah. Psalm 2 and 2 Samuel 7 are linked by
the special designation “Son,” and by their messianic theology (a link
also assumed in NT-era Judaism, e.g., 4QFlorilegium in the Dead Sea
Additionally, Christian commentators since then have seen this specific verse a direct pointer to Christ, that David as the Israelites best king was foreshadowing the Messiah and that the full kingdom of God would go beyond what David had done. Calvin states it this way:
It cannot be denied that this was spoken of David, but in so far as
Christ was in him; therefore, the things we find in this psalm were
foreshadowed in David, but manifested in Christ. When David conquered
the many enemies surrounding his kingdom and enlarged its borders,
there was a foreshadowing of the fulfillment of the promise, I shall
give the nations for thine inheritance. But how little this was
compared with the Kingdom of Christ, which extends from East to West! 2
Given that this was an established interpretation in Judaism (not Christianity, but the Jewish expectation for a Messiah) it is then clear to see why the author of Hebrews used these two passages to reinforce to his audience (1st century Jews) the position of the Messiah.
Lastly, although there are other topics here that address Jesus identity as the Christ, I will cite one way in which there is a direct link to the Jesus of the gospels. There are 4 instances in the gospel in which the audible voice of God uses the same title, “Son” to apply to Jesus.
"and behold, a voice from heaven said, 'This is my beloved Son, with
whom I am well pleased.'” Matthew 3:17
"and the Holy Spirit descended on him in bodily form, like a dove; and
a voice came from heaven, 'You are my beloved Son; with you I am well
pleased.'” Luke 3:22
"He was still speaking when, behold, a bright cloud overshadowed them,
and a voice from the cloud said, 'This is my beloved Son, with whom I
am well pleased; listen to him.'” Matthew 17:5
"And a cloud overshadowed them, and a voice came out of the cloud,
'This is my beloved Son; listen to him.'” Mark 9:7
1 Crossway Bibles. (2008). The ESV Study Bible (2362). Wheaton, IL: Crossway Bibles.
2 Calvin, J., & Anderson, J. (2010). Commentary on the Book of Psalms (Ps 2:7–8). Bellingham, WA: Logos Research Systems, Inc.