The story begins when Nebuchadnezzar of Babylon besieges Jerusalem. He breaks in, conquers the city, and captures the king and some of the sacred vessels dedicated to God in the temple.
After this mad-cap spree, the king orders his palace master Ashpenaz to take some of the royal and well-educated Israelites and bring them back to Babylon to serve at the king's palace. Daniel and his friends Hananiah, Mishael, and Azariah are among the people who get exiled to Babylon.
The palace master makes them cash in their Hebrew names for slick, new Babylonian ones. Daniel receives the totally metal name of "Belteshazzar"; Hananiah, Mishael, and Azariah become respectively "Shadrach," "Meshach," and "Abednego."
Um, is this Kosher?
Immediately, Daniel n' pals run into a problem. The king offers them daily rations of fine Babylonian cuisine and wine—but the food isn't kosher.
Fortunately, God has mercy on Daniel by making the palace master merciful. After some back and forth, he gives Daniel, Shadrach, and co. permission to do a trial run: they'll "go veg" for ten days, eating nothing but water and vegetables. If they don't look worse than everyone else after that time, they can consider the next step to take.
Of course, they end up looking better than the people who are chowing down on the Babylonian cheeseburgers and lobster rolls (or whatever they were serving), and they're allowed to keep eating appropriate kosher and vegetarian meals.
Rather than collapsing from weakness, Daniel and his friends load up on wisdom, knowledge, and skills—all provided by God. Daniel also receives the ability to interpret dreams and visions, which will prove handy pretty soon.
When Nebuchadnezzar finally calls in the elite Israelites, after their training in Babylonian ways has been completed, he discovers that no one is wiser or more knowledgeable than Daniel and his friends. They're superior to all the Babylonian wise men, as well.
The book notes that Daniel remained in Nebuchadnezzar's court until the first year the Persian king Cyrus came to reign.