Time zones were conceived as regular bands of longitude, and almost nowhere do they remain that way. The boundaries as drawn today follow political and economic lines because every offset is a national decision.
The original scheme was astronomical
Dividing the globe into twenty-four bands of fifteen degrees each gives every band a solar noon close to clock noon, which is the entire logic of the system.
The scheme was adopted because railways and telegraphs made local solar time unworkable, since every town keeping its own noon made timetables impossible to write.
What was agreed internationally was the reference meridian and the principle of offsets, not any obligation to follow the theoretical band boundaries on the ground.
Countries choose their own offset
Each state sets the time observed on its territory, and it may choose an offset that does not match the band its longitude falls in.
Large countries have sometimes adopted a single zone across a span that astronomically warrants several, which keeps national administration simple at the cost of solar accuracy at the edges.
Others have shifted their whole territory by an hour or more to align with a trading partner or to move away from a neighbour, which is a policy choice rather than a geographic one.
Borders pull the lines sideways
A boundary that splits a metropolitan area is disruptive for commuting, schooling and business hours, so zone lines are routinely bent to keep such areas whole.
The same applies to islands and territories, which usually follow the time of the state they belong to rather than the band they sit in.
The result is a map where the boundary follows coastlines, provincial borders and occasionally individual county lines, none of which relate to longitude.
Some offsets are not whole hours
A number of jurisdictions observe offsets of thirty or forty-five minutes, adopted as compromises where a whole-hour shift would have placed solar noon uncomfortably far from clock noon.
These fractional offsets complicate any system that assumes time differences come in whole hours, which is a persistent source of software faults.
They persist because changing them would require a national decision with real costs and little visible benefit to anyone already accustomed to the arrangement.
The map is maintained as a database
Because offsets change by legislation, the practical record of world time is a maintained database of rules and their historical effective dates.
Applications rely on it to convert between zones correctly, including for dates in the past, when the rules in force were different from today's.
Every change a government makes propagates through that database and then through software updates, which is why announcing a change with little notice causes real disruption.