The Shinju, or most referred to the ninja world as the Jūbi or Ten-Tails it is basically the god of the shinobi world It is the source of all chakra, that created the lands, and is the progenitor of all life in the Narutoverse. It was generally docile and impartial, even ignoring or being oblivious to the wars raging on around it.
In the beginning it was just a colossal tree that humans worshiped as "The God Tree". Once every thousand years it would bear fruit, but the people were, by tradition, forbidden from touching it. To quell a war, a princess named Kaguya Ōtsutsuki, broke the rules and consumed it, gaining god-like power. She then later gave birth to two sons, Hagoromo and Hamura, whom were born with some of her power.
The Shinju itself would eventually transform into the Jūbi and attacked the Ōtsutsuki family to reclaim it's stolen power, but Hagoromo managed to seal it within his own body to subdue it and becoming the first Jinchūriki and was then on revered as a god. Knowing that the Shinju could be released upon his death, Hagoromo created the moon to trap its body, divided its chakra into nine pieces which would become the Bijū., and then passed the power of the Shinju's eye to his elder son and the power of Shinju's body to his younger son.
Unbeknownst to Hagoromo and Hamura, however, is that it was Kaguya which corrupted the Shinju with her arrogance and greed, seeking to take back the power which was passed to her sons. To that end, she fused with the Shinju and became the Jūbi.