In my french text book it has two sentence "Il a les yeux noirs" and "Il a de grands yeux noirs" I understand that in the second sentence, "de" is actually "des" but it changes because the adjective next to it. So why the first sentence use "les" instead of "des"
Both “Il a les yeux noirs” and “il a des yeux noirs” are possible but using les is more common.
Il a les xxx + mandatory adjective usually means this is something intrinsic, a characteristic of the person while il a des xxx + optional adjective just means this is something the person is currently having.
Il a les yeux noirs.
When talking about clothes, we would on the opposite more use des:
Il a des chaussures rouges.
You rightly wrote that in the second sentence, "de" is actually "des" but changed because of the adjective next to it but note that "elle a des grands yeux noirs" is nevertheless possible, and common in spoken French.
On the other hand, elle a les grands yeux noirs is almost impossible. That would mean the dubious "she has the large black eyes".
The key is the word "grands." When talking about parts of the body, when the subject has them as one would expect (in this case, two eyes of a certain color), one uses the definite article. With the phrase "Il a les yeux noirs," the subtext is that he has two eyes (like normal), and that they happen to be black.
Because grands is a subjective adjective - it changes the meaning slightly to show that his eyes are not as one might expect - they are big! This subjectivity causes the indefinite article to be used.
Actually you can use "les" and "des" for the first sentence.
"Les" just sounds better because it refer directly to the eyes of the guy. But it can also make reference to some eyes that was previously refered in the story (the eyes was mentioned before and now he got it ... in his pocket)
"Des" would keep the doubt from where the eyes come from (not necessarly from the head of the guy you're talking about). Or it can be used to strongify the "noirs" (like it was "very black") but it's not the best way to express that of feeling
Those things I just explained there ... just forget it. Both work. For a single situation 90% would say "les" and 9% would say "des" (1% can't say anything for multiple reason (e.g : blind people))
"Il a les yeux noirs" could be an answer to "how are his eyes ? ", more a precision on a single part,
"il a des yeux noirs" could be an answer to "how is this man ?", more a descriptive feature.
« Il a les yeux noirs » signifie que ses propres yeux sont noirs . « Il a de grands yeux noirs » signifie qu'il a de grands yeux noirs comme ceux qui ont de grands yeux noirs.