It comes down to geometry. In space, the shortest distance between two points is a straight line, but in spacetime things are different.

The last paragraphs of explanation below are essentially what the wiki editors have done at https://en.wikipedia.org/wiki/Twin_paradox#Difference_in_ela... only without acceleration/deceleration phases, since they aren't helpful in understanding the geometry of the problem. Moreover, I'd like to lead you to the same result more gently than wikipedia-browsing would.

On a flat Euclidean plane, between two points there is a single shortest path.
We call that a "straight line", and we can assemble it from line elements which are tiny little steps from the starting point to the ending point. Using Cartesian coordinates (x,y), we can write the line element dS as dS = sqrt(dx^2 + dy^2) -- we do the squaring and take the square root in order to deal with sign differences. We can also write it as dS^2 = dx^2 + dy^2. Dx and dy are tiny steps along the x or y axes, just as dS is the line element: a tiny step along the line.

A plane is a 2-space. Flatness means that the line element above applies everywhere in the plane, even if it goes to infinity in all directions.

On a flat Euclidean 3-space, our line element becomes dS^2 = dx^2 + dy^2 + dz^2. Again, we have a straight line assembled from tiny displacements in one or more of the three spatial dimensions. Flatness, again, means that this line element applies on a line between any two points.

In the 2-space and 3-space cases, the straight line is the uniquely shortest possible line. If we deviate slightly even at one tiny step when building line out of line elements, the line itself is longer.

The form of these line elements are called metrics, and they apply everywhere in each the spaces described above. They have a signature, which can be found by the operators between the coordinates on the right-hand-side of the metric: two + in the 2-space case, three +es in the 3-space case: note that the + in front of the leading term (dx^2) is implicit. Explicitly, we could say dS^2 = +dx^2 + dy^2 + dz^2 Or dS^2 = 0 + dx^2 + dy^2 + dz^2. Because of the squaring and square-rooting, we can alternatively reverse the signs and say dS^2 = -dx^2 - dy^2 - dz^2. We get the same result, but then the signature is three minuses rather than three plusses.

That's space. Now let's consider spacetime.

A Lorentzian spacetime's timelike dimension has the opposite sign. So the Lorentzian extension of a 3-space into a 4-spacetime takes the signature from (+,+,+) to (+,+,+,-) or from (-,-,-) to (-,-,-,+). So in flat spacetime, in Minkowskian coordinates (they're the flat spacetime analogues of Cartesian coordinates (x,y,z) as (x,y,z,t)) we can write the line element as dS^2 = dx^2 + dy^2 + dz^2 - k^dt^2 or as dS^2 = k^2dt^2 - dx^2 - dy^2 - dz^2. "k" here is a constant; it can be set to the value 1, in which case it vanishes. It can be set to a different numerical value, representing a conversion constant between lengths in the spacelike axes and durations in the timelike axis. In our Lorentzian spacetime, the constant is better known as "c".

One thing to observe here is that if "c" is large than the [+/-]c^2dt^2 in the line element dominates.

Say we mark off spatial distances in light-nanoseconds and timelike durations in nanoseconds, so we can make "k" vanish (this is effectively setting c to 1). If your start point is t=0,x=0,y=0,z=0 and your end point is t=onebillion,x=0,y=0,z=0 you've moved one light second into the future and zero light seconds left/right, up/down, or forward/backward. Using (+,-,-,-) sign convention, S is a large number, because we are subtracting nothing from it. However, light travels at one light-nanosecond per nanosecond, so light shining to the left would go from x=0,y=0,z=0,t=0 to t=onebillion,x=onebillion,y=0,z=0. The length of the line is then zero, exactly. Finally, if we have two objects at t=0, one at t=0,x=0,y=0,z=0 and the other at t=0,x=onebillion,y=0,z=0, then when we calculate dS^2 we get negative one billion.

A Lorentzian (one sign difference) metric lets us categorize based on this. For the (+,-,-,-) signature, a positive value for dS^2 is timelike, a zero value is null or light-like (since c relates to the speed of light), and a negative value is space-like.

The absolute value of dS^2 is smallest when dS^2 = 0. Null intervals are thus the "shortest line" through a flat Lorentzian spacetime. Timelike paths are longer.

The origin and rendezvous points in the "twin paradox" or "relativistic galaxy cruiser who comes back", in light years, differ either not at all (or only a small small fraction if we leave/return right near Earth, since the planet moves around a bit in a year). Non-travelling twin is always at or near x=0,y=0,z=0, but moves a full year along t. Most of the path non-traveller's t is changing but the x,y and z are non-changing. Travelling twin, however, moves away from x=0 while moving "left" away and then moves back towards x=0 when moving "right" back. t is changing throughout traveller's trip, of course, but so is x.

We can look at it like this, with non-traveller t,x and traveller t',x':
start: t=0,x=0; t'=0,x'=0. In the very next step, measured in very small units (say, light-attoseconds), and with traveller already accelerated to c exactly, we have t=1,x=0; t'=1,x'=1. In the next step, t=2,x=0; t'=2,x'=2. And so forth.
The values for dS for these first two steps are non-traveller 1, 2 while traveller is 0, 0. When we integrate all these, non-traveller's total is about 3 * 10^26 (that's about the number of attoseconds in a year) while traveller's total is about zero (or exactly zero if we assume instant turn-around, and rendezvous spatial coordinates are x=0,y=0,z=0).

These totals are path-lengths. Non-traveller's path length is extreme, traveller's is zero. Proper times -- what one's cells, wristwatch, and other clocks one carries at all times reflect -- follows these path lengths. The non-traveller ages a year, the travelling-at-exactly-c traveller does not age at all.

Usually you take the traveller as massive and make it travel at a bit less than c, so that the total path length is timelike but short (rather than lightlike and thus null) compared to the extremal timelike path of the non-traveller. Thus the traveller's proper time does pass a little, but not nearly as much as the non-traveller's. Additionally, the traveller is often cast as accelerating and decelerating gently, so there are periods where the x coordinate is changing slowly with respect to t, and periods where the x coordinate is changing close to how quickly t is changing.

The massive gently-accelerating (and decelerating) traveller is what is described at the wikipedia link way above.

Almost finally, the geometry does not depend on choice of coordinates. One can use arbitrary units to tick off durations the timelike axis, and can choose spatial coordinates that are spherical or cylindrical rather than Cartesian-like. The metric for flat spacetime changes form with a change of coordinates[1], but the resulting path lengths and travel times work out exactly the same.

Finally, the metric of curved spacetime is different from that of flat spacetime; the reason you get time dilation around a black hole is because path lengths change because the line elements have a radial dependency such that the paths of objects moving tangentially past a black hole are shorter the further away from the black hole the tangent lies. Gravitation, then, is geometrical.

- --

[1] see, for example, below (10.4) at http://ion.uwinnipeg.ca/~vincent/4500.6-001/Cosmology/Spacet...