It's a matter of wind and the fact that planes fly by airspeed, not by ground speed.
Heading west you're going against the jet stream. Flying north is not only shorter but there's less of a jet stream at very high latitude.
Heading east you're being pushed along by the jet stream. (To the point that on my last flight I was trying to find out if our ground speed was supersonic.) A route that is somewhat longer but takes advantage of this can be the better deal. I've seen tailwinds that were 20% of our airspeed, that's a lot of free travel.
You only see this sort of thing on the very long haul flights as for the shorter flights the gains are never worth it.