the juubi was created from all the hate and other negative feelings in the world, i think... Rikudo Sennin, the initial sage of six paths (SO6P) and creator of ninjutsu, defeated him by absorbing it's chakra, thus making him the first jinchuuriki in narutoverse, and disposed of the juubi's body by imprisoning it in the moon through chibaku tensei... at some point in time, the SO6P divided the juubi's chakra into nine portions, thus creating nine bijuus, i think it was on his death bed...