In the 1700’s a major scientific problem of the day was how to determine the longitude of a vessel at sea. Latitude, you see, can be determined by measuring the angle of the sun to the horizon at its highest point in the day. Longitude was not so simple in those days. Who is credited with solving this problem and how was it solved?
I studied nautical navigation as part of an undergraduate degree, so I'll comment on older and modern techniques. What we really need is someone to talk about the UK Acts of Longitude, which defined prizes for advances in navigation. (Btw, time zones are defined by Great Britain, hence Greenwich Mean Time going through that said city.)
A straightforward way to find longitude is with a chronometer. 'Noon' is defined as the time when the Sun is at zenith. With a 24 hour day, each time zone is 15 Degrees wide. At the equator, each degree is 60' (Minutes), and 1' is equal to 1 Nautical Mile, approximately 1,855 Meters, or a little over 1 Statute Mile. Assuming the chronometer is accurate, your longitude can be interpolated based on the difference in Noon from a known location to your current location.
If I set my watch to GMT and sail West from Greenwich. The next day, I grab my chronometer, and head up to the deck, and mark the time on the chronometer at the local Noon. If local Noon is 1140, or 20 minutes earlier than GMT Noon, I've travelled 5 Degrees West. (20/60 * 15 = 5)
Celestial Navigation is complex due to star charts and triangulation, but the theory is still simple. Assume there is a single bright start exactly at the North Pole. If you're at the North Pole, that star will be exactly above you. If you see the star 60 Degrees above the Horizon, you're also at a latitude of 60 Degrees North. With our single idealized star, this single measurement provides a circle of possible locations. Measuring a 2nd star provides a 2nd circle, which will likely intersect in two possible locations on the Globe. A third measurement will create a confirmed, triangulated location.
Dead reckoning (estimating distance based on previous location, elapsed time, heading and speed) works, but there are many potential measurement errors. If you're measuring your speed through the water, a current in the water will constantly add error to your calculations.
Calculating location closer to shore is outside your scope, but similar to celestial navigation, you measure the bearing to 3 known locations. Ideally, measuring the locations closest to the bow first, as their bearing will change the least as time passes and the ship continues to move. Mark a back azimuth from those locations, and their intersection is your location. Since bearings are straight lines, you get a single intersection with only two bearings. Modern ships may combine use of RADAR as well to measure distance to a known point.
There are many mapping systems in place, and they define Latitude/Longitude based on a defined point. The most common/accepted is "WGS84", but other mapping systems are used and many maritime charts do use a different system. Location from one system to another can be off my hundreds of meters to a few kilometers, depending on the location. A few significant maritime mishaps have been through a mix up of geodetic systems. If you set your GPS to WGS84, but you're using a chart based on a 1927 survey, you will consistently plot yourself a handful of football fields away. Which will be enough to miss a safe channel, and smash into a bridge or rock outcropping.
The intermediary Nautical Navigation system in between chronometers/star charts and GPS, is the early 20th Century LORAN system. LORAN was similar to GPS in that it measured a delay between signals from different radio stations with a known location, which provided two circles of possible locations, which intersected at two possible points.
Aviation Navigation is also pretty interesting, as there are a variety of systems that measure bearing & range from a known location station based on signal degradation, relative signal strength, time delay for a manufactured radio echo and even mechanical directional antennae reception. Chances are, if your commercial airplane has landed you safely in bad weather, you're using an Instrument Landing System that uses relative signal strength to define location on a ray, which I think was also used in WWII by the German Luftwaffe to guide bombers over targets in poor weather.
I wrote about longitude before, in this answer. In addition to the really good answer from u/WinglessFlutters, I feel like I should mention that there were two other ways to determine longitude at sea, which both worked through using lunar distances -- either the relationship between the height of the moon and the angle between it and the Sun or one of various stars. Because Earth's moon progresses relatively quickly through a sweep of the sky (once every 27 days or so) in a predictable fashion, you can measure the angle between the moon and another celestial body at the epliptic. That will give you a reading that you then can feed into an almanac of lunar distances, correct for parallax and then read out into another almanac the predicted times at which those lunar distances would occur -- set up at Greenwich time. The time difference between Greenwich and local time tells you your position, within a quarter minute of arc during the period I study. There's a similar method using the large moons of Jupiter (Io, Europa, Ganymede, and Callisto) but I'm less familiar with the particulars on that.
Now obviously that doesn't work under cloudy or stormy skies, and is subject to a great deal of observer error -- which is one of the reasons why chronometers are so useful. During the period I study, Britain did not issue chronometers to most ships -- only those going far foreign and only after 1790 or so. Captains and other officers could buy their own, but they were expensive -- 60 to 100 guineas new, plus 5 or 10 per year for cleaning/resetting, and ships needed three to correct for errors.