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.
St. John Paul II would become the second pope to choose a double name, taking direct inspiration from John Paul I.