Kenji Koiso (Ryunosuke Kamiki) is a young student at Kuonji High School with a gift for mathematics and a part-time moderator in the massive computer-simulated virtual reality world OZ along with his friend Takashi Sakuma (Takahiro Yokokawa).
One day, Kenji is invited by fellow Kuonji student Natsuki Shinohara (Nanami Sakuraba) to participate in the 90th birthday of her great-grandmother Sakae Jinnouchi (Sumiko Fuji). After traveling to Sakae’s estate in Ueda, Natsuki introduces Kenji as her fiancé to Sakae, surprising them both. Kenji meets several of Natsuki’s relatives and discovers that the Jinnouchis are descendants of a samurai (vassal of the Takeda clan) who challenged the Tokugawa clan in 1615. He also meets Wabisuke Jinnouchi (Ayumu Saitō), Natsuki’s half-great-uncle and a computer expert who has been living in the United States since stealing the family fortune 10 years ago.
Kenji receives an e-mail with a mathematical code and cracks it. Love Machine, an artificial intelligence written by Wabisuke, uses Kenji’s account and avatar to hack the infrastructure, causing widespread damage. Kenji, Sakuma, and Natsuki’s cousin Kazuma Ikezawa (Mitsuki Tanimura) confront Love Machine. Love Machine defeats Kazuma’s avatar King Kazma and continues to consume accounts in the OZ mainframe, creating catastrophic traffic congestion and disabling electrical devices. Two of Sakae’s relatives, Rika (Sakiko Tamagawa) and Shota Jinnouchi (Yutaka Shimizu), discover Kenji’s involvement. Shota arrests Kenji, but the congestion causes Natsuki to return them to the estate.
Sakae calls associates in important positions in Japanese society and relatives who work in emergency services, encouraging them to work their hardest to reduce chaos and damage, comparing the situation to war. Kenji is able to return control of the mainframe to the moderators and engineers. Sakuma informs Kenji that he was not responsible for the panic as he misspelled the last part of the code. Everything returns to normal by the late afternoon, but Wabisuke explains to the entire family that he sold the program to the United States Armed Forces for a test run. After an argument with Sakae, Wabisuke leaves the estate. Sakae later encourages Kenji to take care of Natsuki during a Koi-Koi match.
The next morning, Sakae is discovered dead by Kenji and the Jinnouchis. Her youngest son Mansaku (Tadashi Nakamura) explains that she had angina, and that Love Machine had deactivated her heart monitor. Kenji, Sakuma, and most of the Jinnouchis initiate a plan to defeat Love Machine with a supercomputer using ice blocks as a coolant, while Natsuki and the others prepare a funeral for Sakae.
Kenji, along with Sakuma and the others, capture Love Machine, but Shota carries the ice blocks to Sakae’s body, causing the supercomputer to overheat. Love Machine consumes King Kazma and redirects the Arawashi Asteroid Probe onto a collision course with a nuclear power plant. Meanwhile, Natsuki discovers a will left by Sakae and reunites with Kenji and the rest of the group. Natsuki has Wabisuke return home before the family reads Sakae’s will, asking them to bring Wabisuke back to their lives. Realizing that Love Machine sees everything as a game, Kenji has the Jinnouchis confront Love Machine to play Koi-Koi in OZ’s casino world, wagering their accounts in a desperate attempt to stop Love Machine. Natsuki wins several rounds, but gets distracted and nearly loses her ”winnings”.
However, OZ users worldwide enter their own accounts into the wager on Natsuki’s side, which also prompts the guardian programs of OZ—the blue and red whales known as John and Yoko-to upgrade Natsuki’s account. Natsuki wagers the 150 million avatars given to her in a single hand and critically damages Love Machine, prompting the artificial intelligence to redirect the Arawashi towards Sakae’s estate. Kenji attempts to break into the probe’s GPS, while Wabisuke disables Love Machine’s defenses. After being revived and assisted by several of the Jinnouchi family’s avatars, King Kazma destroys Love Machine. Kenji activates the GPS code to redirect the Arawashi away from the estate, destroying the estate’s entrance and causing a geyser to erupt. In the aftermath, the Jinnouchi family, celebrating their victory as well as Sakae’s birthday, has Natsuki kiss Kenji after they confess their love to each other.