Initially he was King of Sicily, from age four. His kingdom was held for him by Pope Innocent III until he was of age.
He was elected emperor following the Otto IV debacle. Innocent III was a significant supporter and managed to get most of the princes to renounce the excommunicated Otto and elect Frederick. This was confirmed at the Diet of Nuremberg in September, 1211, although he was not crowned until 1215.
Frederick was a very modern ruler for his times, being a patron of science and learning, and having fairly advanced views on economics. He abolished state monopolies, internal tolls, and import regulations within his empire.
He was known in his own time as the Stupor mundi, the "Wonder of the world."