The explanation for this is one of my favorite pieces of mathematical reasoning. First, let's thing about distance; what's the shortest distance between two points? A straight line. If we just drew a straight line between A and B, though, we'd be missing a crucial element of the original problem: we also need to pass through a point on the line (the "river"). Here's where the mathemagic comes in.
If we take the point B and reflect it over the line, creating the point B' (see picture 1), we can draw a line straight from A to B' that passes through a point on the line. Notice the symmetry here; the distance from the intersection point to B' is the same as its distance to B. So, if we reflect that segment back up, we'll have a path to B, and because it came from of the line segment AB', we know that it's the shortest possible distance that includes a point on the line.
If we apply this same process to our picture, we see that the line segment AB' crosses the line
at the point (1, 1)