There was a time when film franchise writers didn't care about continuity. For example, Gotham City changes in each of the Batman films of the '80s and '90s. Knowing this, it's no surprise that when the X-Men films came out, the writers and directors cared little about continuity. They wanted each film to be good on its own merit, and sometimes they succeeded.
What is odd, however, is that even as audiences demanded more and more continuity and consistency between films, the writers and directors continued to ignore them. That is, until X-Men: Days of Future Past attempted to course correct the timeline by introducing time travel, sending characters back in time to retcon the timeline in order to fill in a lot of plot holes. However, this still leaves more questions than answers about the path the films take.
Some Redditors have introduced a few very convincing theories about how the X-Men film franchise is chronologically sequenced. Perhaps these users have untangled the mess that is the X-Men continuity? Let's take a look.
The Initial Theory
Before we introduce the fan theories, it's important to discuss the X-Men universe's most widely accepted theory. The X-Men continuity starts as one singular timeline, with X-Men Origins: Wolverine officially marking the beginning of this original timeline, being the earliest entry in the franchise. But during that opening montage and the prologue to The Wolverine -- baby Logan (Troye Sivan) kills his dad, Sabretooth and Logan go on fighting every war ever and Logan saves Yashida from Nagasaki -- the events of X-Men: First Class take place. The earliest of these, however, is Erik (future Magneto) in the concentration camp run by Sebastian Shaw, future leader of the Hellfire Club. Shaw murders Erik's mother in front of him.
Now, this is where the timeline diverges: during the Vietnam War. In the original timeline, Bolivar Trask (Peter Dinklage) builds the first Sentinels. Mystique murders him in cold blood, which leads to his men capturing her and using her DNA to help create the Sentinel X models that would, half a century later, be used to overtake the planet (in an alternate future, which, after the events of Days of Future Past, never happened).
After X-Men Origins: Wolverine, Professor X, who has lost his hair and can still stand, collects the next generation of X-Men from Stryker's base. Later, Magneto and Professor X, still friends, recruit Jean Grey. From here, the events of the original X-Men trilogy and The Wolverine unfold, leading to the dark timeline of Days of Future Past.
In the alternate timeline, however, thanks to the interference of a time-traveling Wolverine, Mystique doesn't kill Trask, which leads to her becoming a messiah figure. This creates a new timeline, leading to the events of X-Men: Apocalypse, Dark Phoenix, the Deadpool films and the good future seen at the end of Days of Future Past, and, presumably, a few years later, Logan. There's also Deadpool 2, but more on that later.
This was the commonly accepted theory before, but a new model might replace that.
The Three Timeline Theory
The problem with the prior theory is that there are too many plot holes. While Days of Future Past establishes that Professor X can take a drug to grant himself the ability to walk, he loses his powers. Furthermore, he didn't go bald until X-Men: Apocalypse, which could only occur in the Days of Future Past timeline, as Apocalypse is only discovered as a result of the fallout of Mystique publicly refusing to kill Trask. The Xavier of both Origins: Wolverine and the prologue of X3 is bald, walks, and has his telepathy. So how is that possible?
One Reddit user has a potential solution. The theory can be read in full here, but it is very dense and covers ground previously established, so it might be more useful to abridge it to its core differences.
The theory focuses on Sebastian Shaw, the main antagonist of X-Men: First Class. In this theoretical first timeline, Shaw is just a mutant who experiments with his abilities. He isn't involved in conquering the world and he doesn't help the Nazis; nor does he kill Magneto's mom, which results in Magneto emerging from WWII still full of anger. Ultimately, though, Professor X is able to save him and bring him to his side. The Sentinel Project never takes off because the events of First Class don't happen.
Slightly altered events of the later films emerge with, most notably, Shaw serving as one of the Horsemen of Apocalypse. From here, the events lead up to those of Logan. Shaw witnesses the bloodshed and cruelty of man, in particular with X3's Cure.
Now, in X-Men Origins: Wolverine, one of the mutants Professor X saves is Emma Frost -- a much younger Emma Frost than the one we see in X-Men: First Class. In this proposed timeline, Shaw recruits Emma to his side, and, thanks to time travel of some sort, travels back in time, which kickstarts the series of events we already established in the prior section.
The Five (or Six!) Timeline Theory
This theory seems complicated enough. But someone else had to come and make it even more complicated. Here's a handy legend...
This theory focuses less on a theoretical third timeline by focusing instead on the films we have. There are enough continuity issues between the original trilogy and X-Men: First Class that this theory proposes that the timeline of First Class and the original trilogy (book-ended by the first two Wolverine films) is its own separate timeline.
The Redditor proposes that a second timeline featured a slightly-different original trilogy, ignored The Wolverine and moved on to Days of Future Past (presumably because, between The Wolverine and the Bad Future, Wolverine regains his adamantium claws). Then, there's the diverging timeline created by Days of Future Past... or, rather, there are four of them.
This timeline establishes that one of the divergent timelines from Days of Future Past does lead to the events of Logan. However, the rest is affected by another film: Deadpool 2.
Deadpool 2 utilizes time travel as a core component of the plot, with both Cable and Deadpool traveling throughout time to fix several problems. This theory proposes this film led to three diverging timelines: the events of Deadpool 2, which lead to Cable's bad future, the events which lead to a good future and a timeline where Deadpool saves his girlfriend, Vanessa, thus altering what came before.
While this timeline theory sticks closely to the events of the film rather than proposing theoretical timelines, it does come across rather convincingly. While some might argue why The Wolverine is its own separate timeline (couldn't Wolverine replace his adamantium before Days of Future Past?), the rest lines up with the previously established timeline quite well.
In the end, the plot holes between films can be chalked up to the writers just not caring, but these fan theories can help iron out the continuity for fans hoping for fictional universes that make sense. With the X-Men franchise ending after Dark Phoenix, hopefully any future continuities can be made with a little more care put into its timeline. Then again, with everyone still arguing over the treatment of time travel and continuity in Endgame... who knows.