If we look at the early history of the world, a lot of wealth and power sits in the Mediterranean. Egypt, Carthage, Rome, Greece, Hittities, etc. All were concentrated in the Mediterranean. Yet if we look at later history we see a noticeable shift. Instead of being dominant, Greece is conquered by the ottomans, Italy is split between warring kings princes, Spain is conquered by the armies of the caliphate, Egypt conquered again and again, etc. All the major power centers collapse or die off. After this point, it seema the balance of power shifts north. The hanseatic league, HRE, habsburgs, Franks and other Germanic tribes. All rose in prominence.
But why? Why after the fall of the roman empire did the Mediterranean never regain its power and wealth? Why did Northern Europe come to supersede southern in terms of empire building, colonization, and general levels of power and wealth? Why does this divide still exist today?
First, the eastern Mediterranean remained the heartland of powerful and wealthy states for many centuries after antiquity. The very Egypt you cite, despite seeing the name of its ruler change, remained an autonomous and feared power for much of the Middle Ages. And the Eastern Roman Empire and later the Ottoman Empire, when they succeeded in possessing the entire eastern shore from Greece to Libya, was the most powerful state in Europe or nearly so.
Let us come to your answer: why the centre of power in Western Europe undeniably shifted from Italy to the Rhine. The Germanic invasions of the 5th century created a power vacuum in the West, but it would have been temporary. As soon as someone managed to restore order and unity, as in the case of Theodoric's Gothic Italy, Italy would once again become the dominant power in the region.
What changed everything was Justinian's plague, a plague epidemic that scourged the entire Mediterranean (richer, more populated, with many more cities than France) for at least two centuries between 550 and 750 A.D. and a final death toll of at least 25 million. Italy, at the same time the field of war between the Romans and the Goths, would come out absolutely devastated and depopulated and the Roman East itself was no longer the superpower of the time. This was the moment of the real handover between Italy and France and between the Mediterranean and the Rhine.
Btw, I invite you to have a more open look at medieval and modern Mediterranean history. True, Italy never again achieved military supremacy in Europe as it did in Roman times. But if you mention the Hanseatic League, you cannot forget how Italian cities were just as rich and commercial as the Baltic ones, if not more so. In general, Italy and Greece remained rich and at the centre of international trade, even if they lacked military power. It is rather in the 18th century and even more so with the industrialisation of the 19th century that the gap widens for real and becomes similar to what we know today.