Before the railways, time was local and solar: clocks were set by the Sun at noon, so Bristol ran about ten minutes behind London and nobody minded, because no journey was fast enough for the difference to matter. Trains changed that. A timetable cannot work when every station keeps its own noon, so railway companies imposed a single standard time across their networks. Britain adopted Greenwich Mean Time nationally in the 1840s, and other countries followed as their rail networks grew, usually choosing the capital or a major observatory as the reference. The conference also fixed the shape of the day itself: the date would change at midnight at the prime meridian, and a line on the far side of the world, the International Date Line, would absorb the day gained or lost by circling the globe.
In 1884 an international conference chose Greenwich as the prime meridian and the world was sliced, in principle, into 24 zones one hour apart, because the Earth turns 15 degrees of longitude in an hour. In practice the map is far messier. Zone borders bend around countries and communities, Spain keeps Berlin time despite sitting on London's longitude, and China runs one single zone across a width that should hold five. Time zones are agreements, not laws of nature. France held out for years, defining its time as Paris time retarded by a fixed amount rather than saying Greenwich, and other nations made similar face saving compromises. The politics faded; the system stayed, because trains, telegraphs and later aircraft all needed one shared answer to the question of what time it is somewhere else.
The other complication is daylight saving: many zones move an hour forward in spring and back in autumn, on dates chosen by each government. For a few weeks each year, when one country has changed and another has not, familiar differences shrink or grow by an hour. That is why good converters use the IANA time zone database, which records the rules and their history for every region, instead of a fixed list of offsets. A number memorised in January can be wrong by March. Today the zones are maintained as data, not law alone: the IANA database records every region's current rules and their whole history of changes, and it is updated whenever a government moves a border, drops daylight saving or invents a new offset, which happens more often than most people expect.