COPENHAGEN — He was the rare middle-school science whiz to realize his dreams of becoming a celebrated inventor. He started building rockets as a teenager, and mused about making space tourism a reality. Fellow Danes admired his prowess in technology and design, though his temper at times seemed out of place in a society that treasures politeness.

Peter Madsen, 46, is at the center of a mystery that has shocked Scandinavia: the death of a Swedish journalist, Kim Wall, 30, who vanished after boarding Mr. Madsen’s self-designed 55-foot-long submarine on the evening of Aug. 10.

They were the only people on board the vessel, which sank.

After initially telling investigators that he had dropped off Ms. Wall at a remote section of the port of Copenhagen, Mr. Madsen — who has been charged with involuntary manslaughter — changed his story to say that Ms. Wall died while on board his ship and that he buried her body at sea.