Hamura was born as the younger of Kaguya Ōtsutsuki's twin sons, the first people to be born with chakra. When Kaguya realised both Hamura and Hagoromo also had the ability to wield chakra, Kaguya — as the Ten-Tails — tried to forcibly reclaim her chakra out of rage and jealousy. Eventually, Hagoromo and Hamura succeeded in defeating and sealing her within Hagoromo. Some time later, Hagoromo created the tailed beasts and extracted the Ten-Tails' husk from his body and sealed it into the moon, resulting in his death. Before his brother's demise, Hamura and the rest of the clan departed to the moon, in order to guard his mother's sealed remains, though not before receiving instructions from his brother to wait for a full millennium and observe mankind.
In the anime's telling of events, well into their adolescence, Hamura and his brother lived in ignorance of their mother's true amoral nature. While their homeland continued to prosper, people would periodically disappear for a sacred Ritual of the God Tree. One day, the brothers were approached by Gamamaru, who revealed to them that beyond the peak of the nearby mountains lied the truth of the ritual. While initially ignoring the toad's words, Hagoromo grew distressed when a local girl he cared for named Haori, became part of the ritual. When the brothers confronted their mother about ending the rituals, Kaguya dismissed their concern, simply saying it was necessary for "the others' arrival". Finally, after deciding to investigate, the two brothers were horrified to learn that the missing citizens were sacrificed to the God Tree. Wishing to learn more, the brothers sought out Gamamaru. He revealed to them their mother's history of coming to Earth and using the God Tree's fruit to gain great power and enslave much of the land using Infinite Tsukuyomi, including their father. Deciding that they needed more power to confront Kaguya should she turn hostile, Hagoromo began training under Gamamaru in senjutsu. While Hagoromo quickly improved in this art, Kaguya soon caught on to her sons' scheme of rebelling against her using their inherited chakra.
Once Hagoromo returned to confront Kaguya, the mother unleashed Hamura to fight Hagoromo, having brainwashed him earlier. In a risky plan, Hagoromo chose to strike down his brother, freeing him from Kaguya's control before healing Hamura with a special seal tag given by Gamamaru. This also allowed Hagoromo to manifest his Mangekyō Sharingan and Rinnegan respectively. Kaguya realised both Hamura and Hagoromo chose to use their inherit chakra to rebel against her, she — morphing the God Tree into the Ten-Tails — tried to forcibly reclaim her chakra out of rage and spite. Eventually, Hagoromo and Hamura succeeded in defeating and sealing her. Subsequently, Hagoromo created the tailed beasts from the Ten-Tails' chakra and decided to stay and watch over the world, while Hamura decided to go on the moon and watch over their mother. Toneri Ōtsutsuki survived by the time a thousand years had passed and became one of the last Ōtsutsuki clan members.