Iron Man: I'm bringing the party to you. Black Widow: I don't see how that's a party.
~ Iron Man leading a Leviathan
The Leviathans are recurring antagonists in the Marvel Cinematic Universe, serving as major antagonists in The Avengers, and supporting antagonists in Avengers: Endgame. They are giant flying intergalactic beasts that serve as warships for armies under the command of Thanos.
As part of the deal he made with The Other, (the right-hand of Thanos), Loki Laufeyson acquired the Tesseract before having a brainwashed Eric Selvig invent a device to contain its power and to use it to open a portal in the sky. After heading to Stark Towers located in New York City, Loki used the machine to open a portal, allowing the first Leviathan to transport itself and hundreds of Chituari soldiers into Earth. Fortunately, the Avengers arrive in to the rescue as Iron Man managed to catch the first Leviathan's attention by deploying missiles at its face.
As the Leviathan chased after Tony, Tony leads it to Bruce Banner, who transforms into the Hulk and manages to kill the Leviathan by punching it in the face, stopping it dead in its tracks. After Loki watched its demise, he was unperturbed by this as he orders the Chitauri to summon the rest, revealing dozens of more Leviathan appearing from the portal. However, the Avengers countered and destroyed many of the Leviathans with their powers and skills. Despite the Avengers' efforts, many more Leviathans were coming to even the odds against the heroes. Fortunately, Iron Man manages to deploy a missile fired by S.H.I.E.L.D. into the Chituari warship located on the other side of the portal, causing all of the remaining Leviathans and Chituari to fall into the ground and die. This also allows Hulk to finally defeat Loki and allow Thor to take him back to Asgard to face trial for his crimes against humanity.
Avengers: Age of Ultron
The Leviathans made a cameo appearance in this film, where one dead Leviathan was found in a HYDRA research base which was run by Wolfgang von Strucker. Following Strucker's death by the hands of Ultron (who uses Strucker's base to build his his army of Sentinels), Stark had a nightmare (thanks to the powers of Scarlet Witch), where he sees that all of the Avengers have been killed before witnessing many more Leviathans heading towards Earth, foreshadowing Thanos' plan to collect all six Infinity Stones.
Avengers: Infinity War
The Leviathans made a cameo appearance in this film, as they were briefly seen in a flashback attacking the planet Zen-Whoberi and slaughtering the Zehoberei people while Thanos takes one of their children Gamora as his own (known as the Black Order).
The Leviathans returned when the 2014 Thanos back to the future after learning that the Avengers went back in time to retrieve the Infinity Stones to reverse the massacre that his future self committed. Determined that he would have to exterminate all of life in the universe and recreate it in his own image, Thanos sets all the Leviathans, along with the Black Order, Chituari soldiers, Outriders, and Sakaaran Mercenaries to invade Earth. Fortunately, the Avengers brought along many revived heroes, along with several sorcerers and warriors from Wakanda and Asgard, to fight off Thanos' forces. Eventually, Iron Man managed to assemble all of the Stones and sacrificed himself while making a snap to destroy Thanos and his forces for good. As such, all the of Leviathans are disintegrated away along with Thanos and his forces.