The Megalodon is 6x heavier with the most powerful bite in history — if they fought in water.
This fight depends entirely on environment, and the only viable environment is shallow coastal water — the T-Rex can't swim and the Megalodon can't walk.
In water, the Megalodon dominates absolutely. At 50+ tons versus the T-Rex's 9 tons, with a bite force of 40,000+ pounds (vs the Rex's 12,800), the Megalodon would devour the T-Rex like a snack. In the water, the T-Rex loses all mobility and becomes prey.
On land, the Megalodon is a beached fish and the T-Rex wins by default. In shallow water where both can operate, the Megalodon's aquatic superiority gives it the decisive advantage.
6x heavier, 3x stronger bite force, and complete aquatic superiority. The Megalodon evolved to eat whales — a T-Rex in water is a smaller, slower meal.
The T-Rex is the land apex predator with the strongest terrestrial bite. On land or in very shallow water, it has the advantage. But the realistic fight scenario favors the Megalodon.
The Megalodon wins in any aquatic scenario. The T-Rex wins on land. Since these are hypothetical encounters, we give the edge to the Megalodon for sheer size and bite force superiority.
Megalodon also fights
Tyrannosaurus Rex also fights