Barrel (Garden of Barrel) is an organization created in Ancient times by the Artifical God known as Guneden.
Barrel were under the same goals as there god to protect the Earth from any catastrophe. The catastrophe itself was categorized by them as "Hyakuja" which included Youkijin, Einst and possibly others.
At one point Barrel went into deep sleep which then, Son Ganlon took over leading the Barrel. However, several Chokijin who were loyal to Guneden betrayed once Ganlon took over thus those who went against Barrel were Categorized as Hyakuja. The war later was named as Kijin Taisen between the Chokijins. Shikyou & Sh!zai rank and any other lower rank Chokijin (Which are the Youkijin. Ijin in OG Gaiden also part of the Youkijin rank) left Barrel.
The ranks of Chokijin are the following:
Shirei - Highest Rank who've rules all Chokijin ranks. Ganlon's Ouryu is one of them. Shijin - To protect Human Race. Ryuohki, Kohki, Buohki, Jakuohki is under this rank. Shikyo - Toutetsuoh, Kyuukioh (Two other were destroyed during Kijin Taisen) Sh!zai - Apparently all were destroyed during Kijin Taisen. Youkijin - lower ranks
As for what happen with Ryuohki and Kohki. They were also categorized as Hyakuja by Barrel due to going against them. The reason of betrayal was due to vision difference with Ryohki/Kohki and Barrel. Barrel had the ideal to overall save humans as part of protecting the earth while Ryuohki/Kohki wanted to protect humans as a whole. Thus they left barrel while the other two Shijin ranks remained being loyal to Barrel.
As for Guneden, it came from another planet escaping from a catastrophe. Earth was chosen as there last utopia to protect at no cost. Guneden gave blessing to the human race with the Telekenisis which later, by generations, was inherited naturally part of the humans. So far there's no indications who originally created Guneden other than categorized as "ancient civilization". So far there's no (or extremely vague at this point) indication if the "ancient civilization" was connected to the "ancient civilization" that created the Fabla Forest which was a defense system created to seal the "destruction lord".
Also, Tougo Family (Rishu) & Breinstein Family (Ratsel & Rai) were involved in the past wars between Barrel which can be read in the Chokijin Manga.
I think this somewhat should answer your questions. There are more twist actually which was hinted in 2nd OG but further more would be considered possible spoilers for upcoming 3rdOG(?)