WARNING: The following article contains spoilers for Avengers: Endgame, in theaters now.
Time travel plays a central role in Avengers: Endgame. It's the key to the heroes reversing the effects of Thanos' devastating snap in Infinity War, and bringing back all of those lost in the Decimation. As with most films that use the plot devices, the Marvel Studios sequel introduces rules for such time travel, but they fly in the face of those generally accepted in sci-fi.
The film goes so far as to name-check many of those ideas, and pokes fun at their conventions. Endgame, and by extension the Marvel Cinematic Universe, actively disregards the established rules of time travel.
Back To The Future
Time travel becomes an option when Scott Lang is inadvertently released from the Quantum Realm, in which he was trapped in the mid-credits scene of Ant-Man and the Wasp, by a rat that crawls across the console of Luis' van. Discovering five years have elapsed in the real world, Scott quickly finds Steve Rogers and Natasha Romanoff to explain that, for him, only five hours has passed. The Quantum Realm offers the possibility of moving through, and around time, which could (theoretically) allow them go go into the past and try to change the future.
But when Scott bring up the idea to the Hulk and Iron Man, it's quickly shot down. Unlike most time-travel movies, specifically Back to the Future, changing the past in the MCU won't actually have an effect on the future. That shocks Scott, James Rhodes and even the audience. Most such films follow similar logic, that there's only one timeline, so changing the past will radically alter the future. To avoid damaging the timeline, protagonists must not interact with their past selves, change the outcome of specific events, or kill anyone who doesn't need to die. However, as the Hulk and the Ancient One explain, that's not how time travel works in the MCU.
Days Of Future Past
Hulk, who's now merged with Bruce Banner and possesses his intelligence, explains the concept repeatedly to his teammates over the course of Endgame. But when the plan is to acquire the Infinity Stones from the past gets under way, and Hulk attempts to get the Time Stone from the Ancient One, she explains why taking objects from the past and hoping it will have no effect isn't a good idea. She explains that, by going to the past and altering it, the Avengers haven't changed their timeline. No, they've created alternate timelines in which the absence of the Infinity Stones alters how events play out in that history.
For a similar example, look at the original "Days of Future Past" story from Uncanny X-Men. Kate Pryde is sent back in time from a hellish future to warn the present-day X-Men what they need to do to save the world. The X-Men succeed, and keep the dystopian future from materializing. But when Kate Pryde is sent back to her time, it's still the dystopia she left behind. All she really did was create an alternate reality in which the heroes saved the day, which becomes the reality for the X-Men going forward.
Endgame actually follows that concept fairly closely, with the eventual compromise being that the Avengers will return the Infinity Stones after they use them, so that the alternate realities don't become too bad. But on top of that being a major deviance from typical time-travel rules, the film also blatantly ignores one of the canons of time travel: Don't meet yourself. Doing so could alter your actions, and endanger your place in the timeline. That's not the case in Endgame. In fact, some of the heroes actually fight their past selves.
Back In Time
At one point, Captain America is confronted with himself at the Battle of New York, from 2012's The Avengers. After Loki grabs the Tesseract and teleports away (another significant alteration to the timeline), the present-day Cap is confronted by his past self. The two get into a no-holds-barred brawl. In other films that depict time travel, the very notion of running into yourself is a "possible end of the time stream" sort of event. However, in Endgame, you can apparently kill your past self and suffer no consequences.
Just look at Nebula. The version of Nebula from the time of 2014's Guardians of the Galaxy travels into the future, and permits her era's Thanos to make is way to the present. But she's later killed in a confrontation with the Gamora from her time and the Nebula from the present. In other films, a character in the position of the present-day Nebula would have faded from existence once her past self died. But because this was in effect an alternate version of the character (one who traveled to the future), so she had no extra connection to the present Nebula.
But Captain America pulls the biggest time travel no-no when he decides to remain in the past after returning the Infinity Stones. Instead of coming back to the moment of his departure, he opts instead to his life with Peggy Carter, and is an old man when he comes to Hulk, Sam Wilson and Bucky Barnes. That leaves so many questions, even considering how the rules are introduced in the film. He presumably changed the events of Captain America: The Winter Soldier, even if he does become the husband Peggy mentions in the film. Does that create a time-loop? Has an older Captain America been hiding in the suburbs of the MCU this entire time? Because that's just ... weird.
Directed by Joe and Anthony Russo, Avengers: Endgame stars Robert Downey Jr. as Iron Man, Chris Evans as Captain America, Mark Ruffalo as Bruce Banner, Chris Hemsworth as Thor, Scarlett Johansson as Black Widow, Jeremy Renner as Hawkeye, Brie Larson as Captain Marvel, Paul Rudd as Ant-Man, Don Cheadle as War Machine, Karen Gillan as Nebula, Danai Gurira as Okoye and Bradley Cooper as Rocket, with Gwyneth Paltrow Pepper Potts, Jon Favreau as Happy Hogan, Benedict Wong as Wong, Tessa Thompson as Valkyrie and Josh Brolin as Thanos.