Daniel 8 (the eighth chapter of the Book of Daniel) tells of Daniel's vision of a two-horned ram destroyed by a one-horned goat (an allegory for the transition from the Persian to the Greek eras in the Near East), followed by the history of the "little horn", which is Daniel's code-word for the Greek king Antiochus Epiphanes.
The subject of the vision is Antiochus' oppression of the Jews–he outlawed Jewish customs such as circumcision, dietary restrictions, and Sabbath observance, made ownership of the Torah scroll a capital offense, and built an altar to Zeus in the Temple (the "abomination of desolation"). His program sparked a popular uprising which led to the retaking of Jerusalem and the Temple by Judas Maccabeus (164 BCE).
In the third year of Belshazzar, king of Babylon, Daniel in a vision sees himself in Susa, which is in Elam. In his vision he sees a ram with two horns, one greater than the other; the ram charges to the west, north and south, and no other beast can stand against it. Daniel sees a male goat with a single horn come from the west without touching the ground and strike the ram and destroys it. At the height of his power the goat's horn is broken and in its place four horns grow. One of the horns is small but grows great and prospers in everything it does, throwing stars down to the earth, stopping the daily sacrifice, destroying the sanctuary and throwing truth to the ground. Daniel is told the vision will be fulfilled in 2,300 evenings and mornings, when the sanctuary will be cleansed. The angel Gabriel appears and tells Daniel that this is a vision about the time of the end.
It is generally accepted that the Book of Daniel originated as a collection of folktales among the Jewish community in Babylon and Mesopotamia in the Persian and early Hellenistic periods (5th to 3rd centuries BCE), and was later expanded by the visions of chapters 7-12 in the Maccabean era (mid-2nd century). Modern scholarship agrees that Daniel is a legendary figure; it is possible that his name was chosen for the hero of the book because of his reputation as a wise seer in Hebrew tradition.