In 660 AD, a Chinese fleet faces a devastating assault from a mysterious sea monster in the East China Sea, leaving ships shattered and crews reeling. Empress Wu Zetian [Carina Lau] assigns Yuchi Zhenjin [William Feng], a diligent member of the Ministry of Justice, to root out the threat and vows harsh consequences should the investigation miss its ten-day deadline. The young Dee Renjie, [Mark Chao], arrives in the imperial capital Luoyang after earning a place in the Court of Judicature and Revision, also known as Da Li Si, and quickly finds himself entangled in court intrigue. By a chance turn of fate, he overhears a plan to abduct the offering meant to appease the sea monster—the courtesan Yin Ruiji [Angelababy]—even as Ruiji falls into the claws of another monstrous intruder. Dee dives into danger, fights off the kidnappers, and saves Ruiji from a second, humanoid sea creature. Yet when he reaches the scene, Yuchi has Dee arrested and places Ruiji under protective custody. In prison, Dee forms a bond with medical assistant Shatuo Zhong [Lin Gengxin], whose skills help them escape.
Meanwhile, the creature that haunts Ruiji pays a visit, and Ruiji slowly realizes that the creature is her missing lover, Yuan Zhen [Kim Bum], a tea manufacturer. Ruiji attempts to reach him as masked thugs strike their refuge, and Dee, Yuchi, and Shatuo rush to fend them off. After a tense rescue of Yuchi, Dee is abruptly ambushed by Yuan, who has been hiding on the eaves. In the ensuing struggle, Ruiji lashes out and stabs Dee, threatening self-harm, which forces Yuan to flee. Ruiji later confides the truth about Yuan to Dee. Piecing together clues, Dee suspects that the attackers come from the war-torn nation of Dondo and aim to poison the imperial tea to bring down Emperor Gaozong [Chien Sheng] and his court. Dee, Shatuo, and Ruiji track Yuan to a hidden lair, subdue him, and bring him to the imperial doctor Wang Pu [Chen Kun], who administers a sedative.
Doctor Wang Pu uncovers that Yuan’s disturbing transformation is caused by dung beetles, and he devises a cure. When Yuan regains his senses, he recalls being poisoned by the Dondo leader for not taking part in the scheme. Wang Pu then crafts an antidote that can be distributed to the entire court, averting catastrophe. The trio later uncovers a traitor within Da Li Si; in their pursuit they confront the sea monster—an enormous manta ray mutated by Dondo through parasites and poison. Meanwhile, the Empress imprisons Ruiji because she hails from the Fuyu Kingdom, but Dee wagers that if he can capture the rebel leader within a day, Ruiji will be freed. Using clues provided by Yuan, Dee and Yuchi pinpoint a hidden island where the rebels are rallying. They land at night, engage in a fierce battle, and ultimately kill Huo Yi [Dong Hu], the rebel leader.
On their return, the sea monster again menaces the fleet. Dee and his allies deploy poisoned fish bait, drawing the creature in and watching it dragged under as the poison takes effect and the monster dies. The Da Li Si emerges victorious, and the Emperor honors Dee with the Dragon Taming Mace while naming him the new head of the Da Li Si. Following Dee’s counsel, the cured Yuan and Ruiji choose to flee the capital to avoid further conflict with a vengeful Empress, allowing peace to settle back over Luoyang.