In both a positive mitzvah (#495) and a negative mitzvah (#496), the Torah requires us to follow rabbinic enactments. Seven of these are considered the “Sheva Mitzvos d’Rabbanan,” the “Seven Rabbinic Mitzvos.”
The Sages enacted that we are to light candles all eight nights of Chanukah in order to publicize the miracle that God wrought for the Jewish people at the time of the Maccabees. The Syrian-Greeks had taken over the Temple and God enabled a band of Jewish freedom fighters miraculously to defeat them. All of the oil needed to light the menorah in the Temple had been defiled except for a single cruse that was only sufficient to last a single day. God enabled that oil to burn for eight days, until the necessary supply of oil could be obtained.
The basic mitzvah is to light one candle each night per house, though it is preferable to light a candle for each night for each person in the household. (That is, each person would light two candles on the second night, six candles on the sixth night, etc.) The practice is also to light a “helper candle” called a shamash because the Chanukah candles may not be used to read by, to light other candles, or for any other purpose.
The Chanukah story is told in a non-canonical book called Megillas Antiochus, also known as the apocryphal Book of the Maccabees. It is discussed in the Talmud in tractate Shabbos on pages 21a-23b and is codified in the Shulchan Aruch in Orach Chaim 670.