I think it was Pope Leo X.
Pope Clement VII excommunicated King Henry VIII.
The Pope excommunicated Martin Luther in 1520. However, the Elector of Saxony declined to enforce the Bull of Excommunication, which Luther publicly burnt in the university at Wittenberg. In 1521 the Pope issued a further Bull against Luther and called upon the Emperor to enforce it. Instead, Charles called a Diet at Worms. Luther was called upon to recant, but adamantly refused.
Pope Leo X issued Exsurge Domine on 15 June 1520 condemning the errors of Martin Luther, and Decet Romanum Pontificem on 3 January 1521 condemning and excommunicating Martin Luther and his followers, see links below:
Martin was excommunicated because he was trying to go against most of the teachings of the Catholic church. (Which was caused by the 95 Theses, which Luther posted in Germany), The Church finally excommunicated him in 1521, and Luther was later banished in 1522. On 15 June 1520, the Pope warned Luther that he risked excommunication unless he recanted 41 heretical sentences drawn from his writings, including the 95 Theses, within 60 days. Luther set fire to the Popes warning at Wittenberg on 10 December 1520, Martin Luther was excommunicated by Pope Leo X on 3 January 1521 for heresy and apostasy, and for leading others astray.
Martin Luther King did not challenge the pope.
Martin Luther was never made a representative of the pope.
Pope Leo X, who was pope from March 9, 1513, to December 1, 1521, excommunicated Luther.
Martin Luther stated he would only reconcile with the Pope if the Pope accepted his 95 Theses in their entirety. On meeting with the Pope, the Pope accepted only a fraction of them which caused Martin Luther to break with the Communion of Rome.
The pope excommunicated Luther because his teachings were heretical.
He was not a threat at all to the pope
The Pope during Martin Luther's posting of the Ninety-Five Theses was Pope Leo X.
Martin Luther, professor of biblical studies and Augustine monk, initially sought to reform in the use of indulgences. In response, Prierias, Master of the Papal Palace, declared any challenge to the sale of indulgences heretical. Luther proceeded to deny the infallibility of the pope and of General Councils, for which the pope excommunicated him in 1520. However, the Elector of Saxony declined to enforce the Bull of Excommunication, which Luther publicly burnt in the university at Wittenberg. One of the forty one heresies and "pestiferous errors" of which he was accused was the opinion that "the burning of heretics is against the will of the Holy Spirit."