The Earth can be segmented into a Northern and Southern Hemisphere. Those can each be segmented into 90 degrees (times 4 equals 360, a circle). If we choose to divide each of those degrees by 60, we get a Nautical Mile or minute North or South latitude.
The Earth is an oblate spheroid. That means it’s fatter near the equator and therefore when measuring East to West (longitude) the distance is farther per minute near the Equator. The lines also converge at the poles, making them very close together at high latitudes. Due to the inconsistency in longitude, a Nautical mile is a minute of latitude.
When navigating across an ocean, the only tools available hundreds of years ago were the Sun, Stars, and Math. When plotting a position on a chart using celestial navigation and dividers, the consistent minute of latitude is already on the chart. If you travel half a degree of latitude in 2 hours, you travel 30 nautical miles. If you timed that travel, you can predict where you will be in another 2 hours pretty easily if you maintain course and weather/sea conditions remain the same.
TL;DR; miles and kilometers are arbitrary measurements on a chart of Earth, where nautical miles are the Earth divided into 360 degrees all the way around North and South, then each degree is divided by 60 minutes North and South Latitude.
Source: Have navigated with celestial navigation in an airplane for fun.
Latest Answers