Typically when a cardinal is elected pope, he will choose a new name, setting the tone for his papacy. This has been the tradition starting in the 7th century, becoming fully solidified by the 16th century.
Often popes will choose a name that honors a predecessor, such as Pope Benedict XVI, who wanted to honor both St. Benedict and Pope Benedict XV.
For Albino Luciani, he decided to honor two of his predecessors, St. Paul VI and St. John XXIII.
Luciani explained his decision in his first Angelus message.
For that reason I said: “I shall be called John Paul.” I have neither the “wisdom of the heart” of Pope John, nor the preparation and culture of Pope Paul, but I am in their place. I must seek to serve the Church. I hope that you will help me with your prayers.
St. John Paul II would become the second pope to choose a double name, taking direct inspiration from John Paul I.