The answer is: The continents were once connected
Since the dinosaur could not swim or fly, the only method that they can move from one continent to another is if they migrated by land.
From this fact, we can infer that in the past the lands on top of the world were connected (without sea that separate them). These lands than gradually move away form one another due to some sort of geological process over time.