Well, some say that Daniel, also known as Chiliab, was the second son of David, King of Israel, with Abigail, apparently, David’s third wife. (1 Chronicles 3:1; 2 Samuel 3:3). Now, it is true that he had a son named Daniel. And, unlike the other of David’s three elder sons, Amnon, Absalom, and Adonijah who were important characters in 2 Samuel, Daniel is only named in the list of David’s sons and no further mention is made to him. Now, though being the second son, Daniel was not a contender for the throne of Israel, even after the death of the first-born Amnon, the third-born Absalom and fourth-born Adonijah. The throne eventually passed to his younger half brother, Solomon.
But, as to this Daniel being the writer of Daniel, there are some things to keep in mind: First, by 1020 BC, David is already deceased. But, Babylon surrounded and captured Israel in 606 BC. That is 414 year gap between David and Daniel. Second, David reigned over all Israel, but by the time we come to Daniel, the nation had been split to Judah and Israel after the death of Solomon around 922 BC. Third, Zedekiah was the king at the time Daniel was taken to captivity (2 Chron. 36:10), while Jeremiah was preaching (Jer. 27:1). So, I do not believe the writer of Daniel to be the son of David.
Now, I will say that Daniel seems to have descended from one of the highest families in Judah. Possibly of the royal line (Isa 39:5-7). Also, notice Dan 1:3, 7, “And the king spake unto Ashpenaz the master of his eunuchs, that he should bring certain of the children of Israel, and of the king’s seed, and of the princes . . . Unto whom the prince of the eunuchs gave names: for he gave unto Daniel the name of Belteshazzar; and to Hananiah, of Shadrach; and to Mishael, of Meshach; and to Azariah, of Abednego.” So, he was carried into Babylon, along with 3 other Hebrew youths, in the 3rd of Jehoiakim’s reign, about 606-605 BC (Dan 1:1) Jehoiakim’s reigned from 608-597 BC
Now, something else about Daniel, he was probably 15-18 years old when he was carried into captivity (lived at least 85-90, maybe older). He and other Hebrew youths were put into the service of the royal court of Babylon. He was given the Chaldean name of Belteshazzar (meaning Bel’s prince or protector). He was given a thorough education and what especially instructed in speaking and writing the Chaldean language (Dan 1:4). So, while Daniel was a great man, probable of royal decent, but not the son of David. Maybe a descendent from him. But, that is unknown.