Medieval Christian kings might invade their Christian neighbors when they wanted, but when they did they pretended to have some justification to back their aspirations besides a naked land grab. The most common was in the form of dynastical claims. The reasoning was that God had chosen King X to rule over Territory Y because he was legal inheritor to previous king Z, so King W ruling in Territory Y because other reasons was an usurper that had to be removed (meanwhile King W waved his own sets of rights and decry King X as an invader and usurper, of course). It was often hogwash, but appearances had to be kept.
In the case of Charles VIII, he had a distant claim to the throne of Naples (and the throne of Naples alone), since Naples had been ruled up to 60 years before by a French dynasty who had been overthrown by an Aragonese invasion from Sicily, and replaced by an Aragonese cadet branch. In the meantime the Papacy alternated between pro-French and pro-Aragonese Popes, each backing the claim that suited best to their interests. In 1494 the king of Naples died and Charles VIII decided to act on the French claim to Naples by seizing it and removing the Aragonese from there.
He didn't have a claim to the rest of Italy so he didn't bother annexing it. On the other hand, his cousin and successor Louis XII did have a claim on Milan through his mother's side, so when he invaded Italy in 1500 he was intent on annexing both Naples and Milan - but no more.
Because it didn't make sense for France to try to conquer and hold all of the Italian Peninsula -- France wanted control of Naples so that it wouldn't be controlled by the Hapsburgs, not so much because they wanted it themselves. If the Hapsburgs had control of both Sicicly and Cordoba (which they very nearly did at this point), then France's position in the Mediterranean would be much less secure. Futhermore, the Northern Italian city states, as well as the Pope, both opposed the French control of the southern part of the Italian peninsula. The invasion and occupation of Naples and Sicily by the French under Charles VIII, ignited a series of conflicts across Italy that would rage for the next 50 years. The so-called "Italian Wars" were a discontinuous series of conflicts between the House of Valois-Orleans in France and the House of Hapsburg in Spain and Austria, over control and influence in what is now parts of France and Spain, with the smaller Italian states acting as proxies or allies for one or the other. It's worth pointing out that at this time the Kingdom of Franc was significantly smaller than the modern French Republic, and also had much looser control over it's peripheral territories. The efforts that both Charles VIII and his cousin and successor, Louis XII, exerted in their efforts to marry Anne of Brittany, show the importance to the French kings to use dynastic politics to mediatize the de-facto independence of the major Western European dutchies, that while nominally vassals of France, constantly were rival political centers that threatened the integrity of the nascent French state. Aquitane, Brittany, and Savoy are all examples of the larger independent dutchies (dukedoms?) that were significant players in European geopolitics in the late-medival and early-modern periods.
Finally, it should be noted that the fiscal and logistical capacities of 15th-century armies were severely strained by overseas campaigns of any size and length -- Charles's ultimately unsuccessful efforts to project French power into the southern part of the Italian peninsula only succeeded in provoking conflict between the Italian city-states and in draining France of blood and treasure. The legacy of Charles VIII was distinctly mediocre, by the standards of 15th-century rulers -- he died without male heirs (very nearly triggering a succession crisis) and left his polity deeply indebted by the costs of his wars in Italy, yet had little diplomatic or territorial success to show for his expenditures of blood and gold.