The first chapter of the book of Daniel tells the story of Daniel's captivity and indoctrination at the court of Nebuchadnezzar. Daniel 1:8 (NIV) relates:
But Daniel resolved not to defile himself with the royal food and wine, and he asked the chief official for permission not to defile himself this way.
The reason for Danel's resolution is "defilement". The author does not write what this defilement is, but we can assume that the defilement would be from eating non-kosher meat and drinking wine of the gentiles, which was suspect as having been sanctified to the gods of the gentiles. That is, the story of the vegetarian diet in Daniel 1:8-16 is intended to show us that despite Daniels captivity in Babylon as a youth, he kept kosher (in the way it was kept at that time).
As an aside, the following verse, Daniel 1:17
To these four young men God gave knowledge and understanding of all kinds of literature and learning. And Daniel could understand visions and dreams of all kinds.
is intended to show God's approval for studying the culture of the gentiles, which would be prohibited for Jews in most other circumstances.
So the whole first chapter is intended to show us that despite being schooled at the kings court in the culture of the gentiles, Daniel remained a faithful Jew.
As an adult, Daniel was free to prepare his own food, and no doubt ate meat and drank wine, as did all Jews in the Babylonian exile, as implied by the command of Jeremiah 29:4-6. Abstinence from wine and meat for extended periods of time would be considered a sign of thanklessness to God.
So, in Daniel 10:2-3 we are told that during a period of (apparently national) mourning Daniel refrained from eating (kosher) meat and drinking (kosher) wine, but only for three weeks.