Flight paths appear curved due to the flat map (mercator projection), but are actually not quite as curved in reality. This is known as a "great circle" path.
Try it for yourself by finding a physical globe (spherical) and trying to stretch a piece of string between those two distances. You'll find that the string seeks to the shortest distance, which will cross over roughly the same locations that the "curved" path took.
There are generally some slight deviations from the perfect "great circle" path, but those are usually due to weather or jetstream conditions dictating more efficient routes. Transoceanic flights will also sometimes try to remain as close to a shore as possible minimize the amount of time they have to be over water should an emergency occur, but most of the curvature is still due to great circle projection issue.
A more simpler explanation is to obtain a globe, blow up ones are cheap for this purpose that's a sphere of the world, and draw a straight line between the two cities and you'll see that when the globe is 'laid flat' that the route looks quite different although is still the same, the shortest route on our curved planet.
Winds aloft are also part of the calculation. Typically the jet stream is eastbound accross the Northern Hemisphere between 30 degrees and 50 degrees North lattitude. (not exact but close) Eastbound airplanes will fly close to the jetstream in order to catch the tailwind. Westbound airplanes, especially long haul flights, end up north of the jetstream by several hundred miles. That is one reason you see a lot of Europe to west coast flights up across mid to north Greenland where on the same day the eastbound flights are down around southern Greenland.
The great circle route between London and LAX crosses Northern Ireland, very Southern Greenland, Hudson Bay and Eastern Montana.