The kingdom of Naples was clumsily divided in the Treaty of Granada. The center part was unassigned, and both Ferdinand and Louis preferred to take it all by force rather than negotiate its proper division.
When Louis XII ascended to the French crown, he demanded his rights to the Duchy of Milan, because he was the grandson of Valentina Visconti, Duchess of Orleans and Princess of Milan. He also claimed rights to the kingdom of Naples by a descendant of the house of Anjou, which led to an escalation towards the Italian war between 1499 and 1501.
Louis XII, King of France
The Treaty of Granada of November 11, 1500, was a secret pact between the two monarchs by which they split southern Italy between them, after eliminating Frederick IV of Naples.
Ferdinand the Catholic, King of Castile and Leon, King of Aragon, Naples and Navarra.
The company did not prosper and Frederick abdicated in favor of Luis XII which caused the French defeat by the Aragonese Ferdinand II.
After the war of Naples, Ferdinand had the victory, unified Sicily and Naples, and called them: The Kingdom of the Two Sicilies.