The opening text states that the Great Wall of China is one of mankind's most enduring wonders. It spans over 5,500 miles and took over 1,700 years to build. It has protected the city from many dangers, some of which are known, and others that are legend. This story is about one of those legends.
The film opens on Khitan bandits riding through the desert. European mercenaries William Garin (Matt Damon) and Pero Tovar (Pedro Pascal) hide out in a cave along with three other men. The men are traveling in search of black powder. In the cave, the men are attacked by a creature. William kills the monster and cuts off its hand so that he may find someone who can identify it.
William and Tovar ride toward the Great Wall and are greeted with multiple arrows from Chinese soldiers of the Nameless Order. They are taken prisoner by the men and show them the monster's arm. The soldiers react with horror. General Lin (Jing Tian), General Shao (Zhang Hanyu), and Strategist Wang (Andy Lau) question the men over where they came across the monster. When Lin asks why they are there, William lies and says they have come to trade but were ambushed.
The soldiers are alerted to a sighting of more creatures making their way toward the Wall. The generals gather their armies together and make their way to the top of the Wall, with both William and Tovar still being held captive. Hundreds of monsters start running toward the Wall, prompting the soldiers to attack. Lin and her troops hang from cords and descend to battle the monsters. The other soldiers launch flaming rocks and arrows in their direction as they start climbing up the Wall. One monster makes it to the top and starts tearing through the soldiers. William and Tovar are cut free, and they join the fight. With a spear, they take down the monster, while the rest of the horde retreats.
William and Tovar earn the soldiers' respect and are allowed to stay as guests instead of prisoners. They meet Ballard (Willem Dafoe), another European who traveled in search of black powder but was also taken captive. Ballard knows that the men are in China for the exact same reason.
The men are honored by the Nameless Order at a feast. There, William learns that Ballard taught Lin and the other soldiers how to speak English and Latin. William shows off his archery skills to the soldiers, to the delight of everyone in the room.
Lin takes William to show how she fights when hanging from the cord. She tries to get William to attempt it, but he doesn't quite trust her enough to make the jump.
At night, Ballard comes up with a plan for himself, William, and Tovar to take black powder and make their escape while the soldiers are distracted in battle.
William and Tovar speak to Wang regarding a magnetic stone William had on him when he fought the monster on the Wall. Wang tells the men the legend of the monsters, known as the Taotie. Twenty centuries ago, there was an emperor consumed by greed, so the heavens sent a meteor that crashed into a mountain and released the Taotie as punishment for the greed of mankind.
Moments later, the soldiers are alerted to a disturbance near the Wall once again. The Taotie attack the soldiers once again. Shao is killed in the fight. With his dying breaths, he leaves Lin in charge.
The generals receive a scroll from Bianliang, the capital, detailing the use of the magnetic stones as a way to repel the Taotie. William suggests that they capture one of the monsters and sedate it in order to test this strategy.
The soldiers gather for another battle against the Taotie in the midst of a deep fog. William aids Lin during the fight, and Tovar jumps in to help William. The troops manage to capture several monsters by using arrows on chains to bring them down, but William slides down a chain to make sure at least one of those monsters does not get freed by another. Lin utilizes rockets made with black powder against the Taotie, causing some of the monsters to blow up. After a while, William passes out.
William awakens with Lin sitting by his side as he's had his wounds tended. She confirms to him that the Taotie they ensnared was successfully taken in. Lin asks William about the outside world and comments that the greed of men is not so different than that of the Taotie.
The soldiers stand cautiously around the caged monster as it thrashes about. Wang holds some magnetic stones stuck to a stick and hangs it near the monster's face. It retreats at the sight of the stones. One lieutenant says that they must bring the beast to the Emperor.
William goes to see Tovar in his room to thank him for his help. However, Tovar thinks William has pushed him and their goal aside in order to be a hero among the Chinese. He tells William that he will be nothing but a liar. William responds by holding a knife at Tovar's throat in anger.
Taotie movement is detected at the bottom of the Wall. The soldiers head down to investigate and discover a huge hole that the monsters created to get in. Meanwhile, Tovar and Ballard find black powder hidden within the walls. With the soldiers being preoccupied, the two use some of the powder for dynamite to blow open the door to the room where most of the powder is being kept. William hears the explosion and finds Tovar and Ballard taking materials. William says he was a fool for his original quest, but Tovar urges him to follow them. When that doesn't work, Ballard knocks William out and they run out.
Fearing that nothing can stop the Taotie and knowing they have a limited amount of time left before an impending large scale attack, the soldiers head on to Bianliang, the capital city. They show the Emperor (Wang Junkai) the caged Taotie.
Lin finds a captured William and learns of his original intentions. She is infuriated and says she would kill him herself. A young soldier, Peng Yong (Lu Han), defends William and informs them that Tovar and Ballard took the powder. Lin orders William to be locked up while she and her troops go after the other two.
Tovar and Ballard are riding through the desert. Ballard ditches Tovar when he senses danger approaching. Tovar is taken by the Chinese soldiers while Ballard is captured at night by the Khitan bandits. They accidentally ignite his powder and blow themselves and Ballard up.
The soldiers use hot air balloons to fight the Taotie over the city, but the balloons start bursting into flames, sending some of the soldiers plummeting to their deaths. William is let out of his cell and is informed by Wang that the new objective is to kill the Taotie queen. William is about to board a balloon with Wang before Peng Yong arrives and requests to join them.
The Emperor removes the magnetic stone from near the Taotie in order to assume control of the beast, but this causes it to wake up and summon the other monsters to its location.
Every army is flying high above the city as the Taotie are wreaking havoc. They burst from buildings as the troops fly overhead and retaliate. Most of the city is in flames and ruined. The troops shoot arrows and more rockets at the monsters as they attempt to make their way toward the queen. William, Wang, and Peng catch up to Lin as they spot the queen being surrounded by thousands of Taotie as they protect her.
The heroes reach the palace and approach the Emperor. Wang requests that they find the captured monster to use in order to kill the queen. The Emperor tells them that the beast is in the dungeon. The troops put explosives all over the monster and feed it meat to bring to the queen. They go through an underground canal as the rest of the monsters are above ground. The Taotie crawl above them and try to snag them from up top. Peng holds the monsters off but is wounded in the struggle. He stays behind while the others continue moving forward. Several monsters burst in and rush toward Peng. He ignites some black powder and blows himself and the monsters up.
William, Lin, and Wang run into a tower to let the captured Taotie out. They hold it off with the stones and it rejoins the monsters. The three head up the tower to strike the queen. They get a good shot from the top of the tower and proceed to fire rockets at the queen, but she is protected by larger beasts with scales that deflect the rockets. Wang is at the bottom as the beasts storm the tower and begin to attack. Wang throws Lin a stone right before he is killed. William tosses the stone into the path of the queen before Lin launches the rocket. The rocket explodes and obliterates the queen, leading to the rest of the Taotie to drop dead.
Upon their return home, Lin is promoted to regional general. William is to be given a reward - namely a big quantity of black powder -, but he instead chooses to have Tovar freed so that they may return to Europe. William and Tovar reconcile, and after biding their goodbyes to Lin, they head on their way home with a cavalry following them for protection.