Upvote:2
As a tourist, you probably have a visa for all Schengen states. Check your visa, it should say "Stati Schengen" or something like that. That means you can travel through all Schengen states as long as that travel is consistent with your statements and your itinerary in the visa application.
You wrote that you applied to visit Germany and Italy. If you simply cut your visit short and travel home partway through your itinerary, there will be no problem. If you travel to another Schengen state to catch a flight from there, there will be no problem, either. If you stay much longer in Germany than planned, there may be questions.