WW was from CP9, faced Shanks' crew and lost the Gomu Gomu no mi, which ended up being eaten by Luffy.
For that mistake, he was imprisoned for 10 years at Impel Down, which is where he met Jinbe.
When Blackbeard released level 6 prisoners in Impel Down, he ran away and is a little over 2 years in Kaido's crew, so that's the chronology.