Diderik Hegermann was born at Altona in Schleswig-Holstein. In accordance with family tradition, he chose a military career. He became a cadet in 1776 and served as a Sergeant until 1786. He became a Lieutenant in 1786 in the Corps of Cadets in Copenhagen. In 1790, he was appointed Captain. In 1800, he was promoted to Major and appointed commander on the War School in Christiania (now Oslo). In 1808, he became Lieutenant Colonel and from 1812 he was commander of Oppland Infantry Regiment. Hegermann served as Colonel during the Swedish–Norwegian War (1814). He led the defense at the Battle of Langnes.