Karl was born Jean-Baptiste Bernadotte, the son of a French lawyer. He entered the army aged 17 and rose in the ranks to great influence and fame under Napoleon.
Sweden was ruled at the time by Karl XIII, who was old and childless, and the government of Sweden asked the advice of France about what to do. On French advice Bernadotte was elected crown prince, moved to Sweden and although an adult, was formally adopted by Karl XIII. When Karl died in 1818, Karl Johan succeeded him and ruled well for over 20 years.