One of the features that made the last two "Avengers" movies distinct from other superhero fare is that the villain, Thanos (Josh Brolin), wasn't motivated by the usual "take over the world" agenda. As he explained to his adopted daughter Gamora (Zoe Saldana), "It's a simple calculus. This universe is finite, its resources finite. If life is left unchecked, life will cease to exist. It needs correcting." When Gamora protested that he couldn't possibly know that to a certainty, Thanos responded, "I'm the only one who knows that. At least, I'm the only one with the will to act on it."
If you're familiar with the work of Thomas Robert Malthus, this logic will sound familiar. In his 1798 book "An Essay on the Principle of Population," Malthus argued that resource abundance led to population growth rather than a high standard of living and would eventually become unsustainable. Malthus' ideas remain hotly contested to this day, but they are simple enough — and, perhaps most importantly, easy enough to interpret on behalf of a tyrannical, mass murdering agenda — that it is logical a variation of them to show up in a fictional supervillain's philosophy.
One of the best things about "Avengers: Endgame," though, is how it uses that philosophy to look into Thanos' soul — and how the Avenger who winds up killing Thanos was the living embodiment of the opposite worldview.
When the audience sees Thanos again for the first time in "Avengers: Endgame," the mad titan has retreated to a garden planet to retire. Notably, one of the first things Thanos did was destroy the Infinity Stones, both so that his work in killing half the universe's population couldn't be reversed and so that he wouldn't succumb to the temptation to use the stones to become a living god. Considering how many comic book fans believe that Thanos is the single most powerful figure in all of comic books, that decision is a big deal. It seemingly establishes that Thanos, no matter how evil his actions may have been, was genuinely motivated by a desire to make the universe a better place rather than by egotism or power lust. And as Captain America/Steve Rogers (Chris Evans) observes to Black Widow/Natasha Romanoff (Scarlett Johansson), a pod of whales has been spotted in the Hudson River, near New York City. The population reduction strategy, though evil, was not without its benefits.
Yet once Thanos begins to see his agenda as an "inevitability" (his word), and is confronted with the possibility that this destiny may be thwarted by the Avengers, a different side of him emerges. Instead of seeing that the moral consequences of his iconic finger snap were too much for the world to bear — that the universe would much rather deal with its resource allocation problems in a humane way than simply kill off half the population — Thanos instead argues that life is stubbornly unwilling to accept the wisdom of his approach, and is therefore unworthy of living at all. Until he is thwarted by Iron Man/Tony Stark (Robert Downey Jr.) at the last second, his new plan was to obliterate all life in the universe and replace it with a new universe created by himself. It is here that the supposed idealism which motivated Thanos is revealed to be an illusion, and Thanos is identified as a true monster without even the facade of a noble cause to redeem himself.
This brings us to Stark's character arc — specifically, how it was thematically appropriate for him to be the Avengers who makes the ultimate sacrifice in taking Thanos down.
When we first meet Stark in the 2008 film "Iron Man," he is an amoral weapons manufacturer whose only concern is turning a profit. Although he becomes a superhero by the end of that film, he is still motivated by selfishness through the 2010 sequel "Iron Man 2," during which Stark directly reenacts plot points from "Atlas Shrugged." Like Hank Rearden, one of the protagonists of Ayn Rand's novel, Stark is dealing with a federal government that wants to confiscate his Iron Man suit for its own purposes. In defying them, Stark asserts a philosophy of proud selfishness by declaring, "You want my property? You can't have it!" He later adds, "I will serve this great nation at the pleasure of myself."
Yet unlike many other Randian acolytes, Stark's views evolve as he begins to comprehend the consequences of a purely selfish approach. In the 2015 movie "Avengers: Age of Ultron," Stark creates an artificially intelligent robot named Ultron (James Spader) who believes that human beings need to go extinct to create a better world. Because Ultron's existence was solely the fault of Stark and Hulk/Bruce Banner (Mark Ruffalo), who disregarded warnings about the possible consequences of creating a robot because they insisted they were fighting for a greater good, each man bears moral responsibility for the lives lost during Ultron's murderous rampage. Stark in particular remained humbled by the experience; in the 2016 film "Captain America: Civil War," he and Rogers feud over whether superheroes should be accountable to a third-party, democratically accountable agency. As Stark correctly observes, "If we can't accept limitations, we’re boundaryless, we're no better than the bad guys." When Stark reunites with Rogers at the start of "Avengers: Endgame," this conflict is clearly at the forefront of his mind — he berates Rogers, not incorrectly, for opposing a plan that if implemented would have made it easier for the Avengers to coordinate a resistance to Thanos and prevent his act of cosmic genocide.
While both Thanos and Iron Man balance egotism with idealism in the beginning, and neither fully shed their arrogance or self-absorption, Iron Man's redeeming quality was his willingness to learn from his mistakes. The feckless billionaire playboy from the beginning of "Iron Man" and greedy capitalist in "Iron Man 2" eventually became the advocate of reasonable government regulation in "Captain America: Civil War" and, finally, the Christ-like figure willing to die so that the universe can live at the end of "Avengers: Endgame." This doesn't mean that Iron Man loses his individualistic streak; it is appropriate that, while Thanos' ability to wield the Infinity Stones depends on a gauntlet that he merely acquired, Iron Man's ability to use those same stones to stop Thanos depends on technology that he invented himself. It is Stark's brain, as well as his superior moral character, that saves the day.
I suspect that, when future cultural historians look back at "Avengers: Endgame," they will find it telling that the final boss of this era in Marvel Cinematic Universe history was motivated by what in Earthly terms would be referred to as environmentalism. When the filmmakers decided to endow Thanos with a semi-sympathetic motive, they chose to reference humanity's destruction of the natural world — global warming, pollution, the destruction of our wilderness — as well as Malthusian ideas that are only slightly younger than the ones which animated the American Revolution. It is also notable that, in defeating Thanos, they didn't respond with the comic book equivalent of a reactionary, although the character of Iron Man (both in its comic book form and in the early movies) could have lent itself to such an interpretation. Instead they contrasted an uncompromising extreme with a flexible, intelligent and humane alternative.
And that's why it remains so powerful to consider the final dialogue exchange between those two characters, when Thanos says that he is inevitable and Stark simply responds, "And I am Iron Man."