From 1309-1377 the popes moved from Rome to Avignon because of a dispute between France and Rome. A French pope (Clement V) decided not to move to Rome and instead established his papacy in Avignon from where the next seven popes ruled. Gregory XI decided to move back to Rome. Upon his death the new pope Urban VI was disliked by some cardinals who reestablished a papacy in Avignon for a short period and considered illegitimate and called anti-popes. This lasted through two popes and ended in 1407.
Palais des Papes was home to all this and is the centerpiece of Avignon. Many renovations adding portions and then taking portions away depending on the pope (or anti-pope) and lots of restorations some good and some not so good have taken place since. Well documented for a visit with simulations, reading material, etc.
The Palais des Papes remained under Papal control until taken over by Napoleon.