Originally, southern Italy was owned by the Staufer dynasty under Friedrich II. The popes however claimed suzerainty and also felt threatened by the Staufers. So they looked for help from outside, and in 1266 Charles of Anjou came to power in Naples-Sicily after defeating and killing regent Manfred. 1268 Konradin, last descendant of Friedrich II, was killed by Charles. Craving for more power, he also made the French start the Seventh Crusade against Tunis in 1270 (Palestine was originally planned, but Charles thought Tunis was better - it certainly was closer to his new lands in Italy), which ended in a defeat and king Louis IX's death. 1272, he additionally conquered the area of Albania. But in 1282 he suffered a defeat in the Sicilian Vespers. All French on the island were killed, Sicily became a part of Aragon.
The situation in the country improved much under Robert / Roberto I the Wise, who ruled 1309-43.
But during 1414-18, for the first time for centuries, people in Western Europe were horrified again of "Asian hordes": A Seljuk-Barbary fleet crossed the Adria, landed near Taranto / Otranto, swept through Apulia. The king of Naples was horrified and asked anyone he could contact for help. Without success: France was still locked in a hard war with England and Castille; the Hungarian king would actually have liked to help, but the powerful nobles forbad him to send an army south while Hungary proper was threatened; the northern Italian states were busy mopping up the smaller states in the region. The pope called for a crusade, but even that didn't help much. Being desperate, the king made an alliance with Naples' old enemy Aragon, ceding Sicily officially, for once and ever, to them. The new alliance managed to defeat the Seljuks in the South. Especially their cannons helped them a lot to reconquer the cities. Only Taranto and Bari in Apulia were held by the Seljuks. In 1418, an armistice was made - but both sides planned to restart war, when the time would be right.
The Rum-Seljuks found the time right first, in the Great Napolitan War 1425-36. After the Seljuks had managed to hire an expatriate Italian willing to equip their army with cannons, they restarted the war.
When the pope and the Anjou king of Naples asked Charles IV for a crusade against the Seljuks, he agreed. He made peace with the English, leaving Guyenne in their hands; king Richard III had to accept it as a fief, though. 1427, after preparations, France entered the war on Naples' side. After the French almost managed to defeat the Rum-Seljuks, the latter were exceptionally lucky in 1431: During the battle, the king was captured. He had to promise to leave the war to be released again. Now the tides of war turned again. 1436, king Roberto III fell in battle. His son was just four years old, and had to make peace. The greater part of Naples became Seljuk; only the western third with Pescara, Benevent, and Naples itself survived as a tributary.
The population hated the Muslims from the very beginning (although there were conversions too), so as soon as in the 1440s, the Carbonari (charburners), the anti-Seljuk resistance in Naples, started to form. But still, in the years 1459-61, Naples was completely subjugated by the Seljuks. Everyone feared that the Papal States would be attacked next (which would indeed be the case). The helpless pope fled to Avignon, as did king Charles / Carlo V. He would spend the rest of his life agitating the courts against the Seljuks and finally fell against them 1509 in the Austrian-Seljuk War.
Under Seljuk rule
Many Muslims (soldiers first, soon merchants too) from all parts of the vast Seljuk empire settled, mostly in the bigger cities, like al-Nabuli (as they called the city of Naples). Muslim scientists started to note the inventions of the Christians that had been made in the last centuries, like printing and optics.