He was born in Munich, the son of a businessman Karl von Hagn and his wife Josepha Schwab.
After a brief public education, he followed his family's wishes and entered the local Cadet School.
Soon after, he left the Cadet Corps and became a student of the marine painter Wilhelm Krause.
From 1853 to 1855, he was in Paris, where he became interested in the works of Léon Cogniet, Paul Delaroche, Jean-Louis-Ernest Meissonier and Joseph Nicolas Robert-Fleury.
During this time, he became lifelong friends with his former Belgian colleagues Florent Willems and Alfred Stevens.