מאי חנוכה דתנו רבנן בכה בכסליו יומי דחנוכה תמניא אינון דלא למספד בהון ודלא להתענות בהון שכשנכנסו יוונים להיכל טמאו כל השמנים שבהיכל וכשגברה מלכות בית חשמונאי ונצחום בדקו ולא מצאו אלא פך אחד של שמן שהיה מונח בחותמו של כהן גדול ולא היה בו אלא להדליק יום אחד נעשה בו נס והדליקו ממנו שמונה ימים לשנה אחרת קבעום ועשאום ימים טובים בהלל והודאה

The Gemara asks: What is Hanukkah, and why are lights kindled on Hanukkah? The Gemara answers: The Sages taught in Megillat Taanit: On the twenty-fifth of Kislev, the days of Hanukkah are eight. One may not eulogize on them and one may not fast on them. What is the reason? When the Greeks entered the Sanctuary they defiled all the oils that were in the Sanctuary by touching them. And when the Hasmonean monarchy overcame them and emerged victorious over them, they searched and found only one cruse of oil that was placed with the seal of the High Priest, undisturbed by the Greeks. And there was sufficient oil there to light the candelabrum for only one day. A miracle occurred and they lit the candelabrum from it eight days. The next year the Sages instituted those days and made them holidays with recitation of hallel and special thanksgiving in prayer and blessings.

מאי חנוכה - על איזה נס קבעוה:

On which miracle is this [holiday] affixed?

Baal HaMaor on Masechet Avodah Zarah 24a

How could the holy items in the Temple have become impure through a non-Jew given the principle that a person cannot render unfit for use items which are not theirs?

The holy items in the Temple, like the stones of the altar and the silver and gold of Jerusalem could have certainly become "non-holy" through a Jew, as they are considered children of the Most High...but through a non-Jewish idolater, who is not considered a child of the Most High, they could not have been made impure. Therefore its necessary to say, according to the opinion of Rav Papa in the Gemara, that through corrupt Jews the items in the Temple were deconsecrated...this is the interpretation that I have learned from my teachers

1 Maccabees: 1:11-15, 2:15-27

11 It was then that there emerged from Israel a set of renegades who led many people astray. 'Come,' they said, 'let us ally ourselves with the gentiles surrounding us, for since we separated ourselves from them many misfortunes have overtaken us.'

12 This proposal proved acceptable,

13 and a number of the people eagerly approached the king, who authorised them to practise the gentiles' observances.

14 So they built a gymnasium in Jerusalem, such as the gentiles have,

15 ceased practicing circumcision, and abandoned the holy covenant, selling out themselves and their traditions to become like the Greeks around them...

...15 The king's commissioners who were enforcing the apostasy came to the town of Modiin for the sacrifices.16 Many Israelites gathered round them, but Mattathias and his sons drew apart.17 The king's commissioners then addressed Mattathias as follows, 'You are a respected leader, a great man in this town; you have sons and brothers to support you.

18 Be the first to step forward and conform to the king's decree, as all the nations have done, and the leaders of Judah and the survivors in Jerusalem; you and your sons shall be reckoned among the Friends of the King, you and your sons will be honoured with gold and silver and many presents.'

19 Raising his voice, Mattathias retorted, 'Even if every nation living in the king's dominions obeys him, each forsaking its ancestral religion to conform to his decrees,

20 I, my sons and my brothers will still follow the covenant of our ancestors.

21 May Heaven preserve us from forsaking the Law and its observances.

22 As for the king's orders, we will not follow them: we shall not swerve from our own religion either to right or to left.'

23 As he finished speaking, a Jew came forward in the sight of all to offer sacrifice on the altar in Modiin as the royal edict required.

24 When Mattathias saw this, he was became infuriated; shaking with rage, he threw himself on the man and slaughtered him on the altar.

25 At the same time he killed the king's commissioner who was there to enforce the sacrifice, and tore down the altar.

26 In his zeal for the Law he acted as Phinehas had against Zimri son of Salu.

27 Then Mattathias went through the town, shouting at the top of his voice, 'Let everyone who has any zeal for the Law and takes his stand on the covenant come out and follow me.'

28 Then he fled with his sons into the hills, leaving all their possessions behind in the town.

I Maccabees 4:42-58 (translation from Oxford Standard Revised Edition of the Bible)

He (Judah) chose blameless priests devoted to the law, and they cleansed the sanctuary and removed the defiled stones to an unclean place. They deliberated what to do about the altar of burnt offering, which had been profaned. And they thought it best to tear it down, so that it would not be a lasting shame to them that the Gentiles had defiled it. So they tore down the later, and stored the stones in a convenient place on the temple hill until a prophet should come to tell what to do with them. Then they took unhewn stones, as the law directs, and built a new altar like the former one. They also rebuilt the sanctuary and the interior of the temple, and consecrated the courts. They made new holy vessels, and brought the lamp stand, the altar of incense, and the table into the temple. Then they offered incense on the altar and lit the lamps on the lamp stand, and these gave light in the temple. They placed the bread on the table and hung up the curtains. Thus they finished all the work they had undertaken.

Early in the morning on the twenty-fifth day of the ninth month, which is the month of Kislev, in the one hundred forty-eighth year, they rose and offered sacrifice, as the law directs, on the new altar of burnt offering that they had built. At the very season and on the very day that the Gentiles had profaned it, it was dedicated with songs and harps and lutes and cymbals. All the people fell on their faces and wished and blessed Heaven, who had prospered them.