A thousand years ago, Banya believed that Bub-Woon killed his mother, Hwa-Yeon, in order to steal her orb. Feeling betrayed by the misunderstanding, Banya went on a rampage, bewitching people so he could eat their livers in order to become more powerful, corrupting himself to the point that he almost became a Maegu.
Because Banya would not listen to reason, Bub-Woon was forced to seal him into this scroll so that he could keep Banya's Orb pure, so that he may become a god like his mother wished. Unfortunately, Bub-Woon fell off a cliff after sealing him, and refused to resurrect himself with Hwa-Yeon's orb, saying that it was good that he died, because that way, Banya would be forced to become a Ninetails strong enough to become a god.
Banya was then passed to Lee So-Yoon's Ancestor, who was a former priestess serving under Hwa-Yeon, to keep him safe for 1,000 years, when Bub-Woon would reincarnate. However, she wanted to get something in return for keeping Banya, so Mok-Young told her that Banya would become her guardian, since it would force Banya to gather virtue. Satisfied with the result, she took him in.
So-Yoon's ancestor released his physical form from the scroll (as only Bub-Woon himself could actually free him) and forced him into a contract with her, where he'd protect her from danger and her god's wrath on herself and all her descendants (as it was inevitable for humans not to sin, often causing their god to either punish or leave them), which Banya stated it would make him her slave. Banya ultimately accepted the contract, meaning that every crime that a Medium in So-Yoon's family committed, it would be rebound onto Banya himself.
Banya then formed another contract, this time with Bong-Hwang, so that whenever a medium was born, Banya would be able to leave the scroll at will, in exchange for Orb. When he became a Ninetails with enough virtue to ascend to godhood, Bong-Hwang promised to return his Orb.