In Avengers: Endgame, how does Captain America lift Thor's hammer?
In Avengers: Age of Ultron, he is not worthy, but how is he now in this film?
It was always unclear why Captain America couldn't lift Mjolnir in Age of Ultron.
Was he not worthy at all? Unlikely; it's Captain America after all, worthiness goes with the character, his MCU version at least. Plus, Mjolnir did move. (Note that in the comics, Cap has wielded Mjolnir)
Was he not completely worthy yet? Possibly. After all, there is still room for the Avengers to improve.
Was he actually refraining? By Endgame, this is the most likely. There's been talk about Captain America realising he could lift Mjolnir, but wouldn't, not to create an awkward situation for Thor. Thor was baffled at the sight of Mjolnir moving... And by Endgame, when Steve calls upon Mjolnir, he says:
I knew it!
Meaning he had more than suspicions about Captain America being worthy.
This has also been confirmed by the various officials. Quotes borrowed from this SFF answer:
GeneralBenKenobi: Could Cap always wield Mjolnir (meaning he could have picked it up in Age of Ultron and decided not to), or did he progressively get more worthy over time?
Russo_Brothers: Anthony: He always could. Our interpretation of the famous scene in Ultron was that when he realized he could pick up Mjolnir he quickly chose not to, because he didn't want to embarrass Thor.
KrazzyDJ: Cap lifting Mjolnir was one of the strongest (crowd-cheering) moments in Endgame. Does he become worthy in that moment or has he been worthy for a while since, say, Avengers: Age of Ultron?
KevFeige: We think he was always worthy and was being polite in Age of Ultron.
The reason why Cap managed to do so is already explained in Thor Trilogy. Thor was unproved of worthy in Thor when he committed a war which could lead to deaths of many. However, when he was willing to sacrifice himself for those who he loved by the end of the film, he proved himself worthy. Even Jane was able to lift it since he was going to sacrifice herself for Asgardians, who hated her at that time.
For the same reason, Captain America was also worthy to lift the hammer. However, the main question is why he couldn't do this in Age Of Ultron. The reason behind this is that he could lift Mjolnir at that time and even it moves a little, but he saw the look at Thor's face and decided not to make him feel devastated by the fact that a mortal can lift Mjolnir.
However, the move of Mjolnir did make Thor suspicious which he became sure when he saw Cap lifting it in Endgame and that's why he says "I knew it". In Endgame, Cap didn't have any choice but to use Mjolnir when he saw Thor being defeated by Thanos.
“How is Steve Rogers not worthy?” a fan asked. “Is he not? Are we sure?” Whedon responded, a hint of teasing in his voice. “Did he fail? Or did he stop?”
For those who don't know: Joss Whedon is the director for Age of Ultron. He stated that in 2015.
Like others have already said, Cap has been worthy. Also, I've seen people ask how he was able to use lightning too. Remember, before Ragnorok Thor needed the hammer to use lightning. And in Thor 1, Odin took everything back from Thor because Thor was unworthy. Odin cast him out and enchanted the hammer with these words:
"Whosoever holds this hammer, if he be worthy, shall possess the power of Thor.”
To give Thor a chance to earn the power back. Which he did. The enchantment stayed too.
I believe he couldn't in Ultron because he had Bucky's secret that he killed Tony's parents. After the events in Civil War he had no secrets and became worthy.
In the comics Thor said the enchantment that Odin put on Mjölnir allows "very few worthies" to lift it in "desperate hours". Given that Thanos was about to kill Thor and would have killed everyone and everything, I'm guessing that qualifies.
If you watch the scene, Captain America doesn't appear to be holding back and as Vision put it, it's very well balanced. If Captain America was worthy of lifting it in Age of Ultron, even the slightest pull would've lifted it.
Why he couldn't lift it in Age of Ultron is most likely because it just isn't the time. The fact that he could shift Mjölnir, was likely just showing he is one of the very few worthies, but there was no dire threat, so Mjölnir refused him.