Davy Jones was the King of the Ancient Kingdom (foreshadowed by Teach wanting to become King of the World)
Joy Boy was a random kid, who grew up in the Ancient Kingdom, then sailed out to explore the rest of the world, like Luffy: a small spark, that grew into a giant flame.
The 20 Kingdoms were ruled by descendants of Gods from Nika's age, while the Ancient Kingdom was a meritocracy/diverse utopia that used advanced technology. Davy Jones and Joy Boy became friends through fighting each other, like Noland/Calgara, and Rocks/Harald.
Imu convinced Davy Jones that Joy Boy was working against the Ancient Kingdom using magic fuckery, and Davy Jones broke the promise, by going against Joy Boy's wishes and declaring war against the 20 Kingdoms. Imu used this war to pit his enemies against each other, and then take over.
Davy Jones' treasure was connected to the Kingdom, and is in "Davy Jones' Locker", where all the treasure in the world goes when it sinks. Davy Jones' Treasure is the One Piece, or a part of it.
After realizing he had been betrayed by Imu, and had failed to believe Joy Boy, Davy Jones swore his descendants would rise up against Imu, join again with Joy Boy, and defeat the World Government.