Because there is a the local government, which governs cities, towns, and villages; the state government, which governs states; and the federal government, which governs the entire country.
In the state and area where the crime took place. If a crime is committed in one area, it’s not fair for them to give a trial in an area in which the crime wasn’t located.