$eta$ Carinae is an extraordinary massive star famous for its 19th century Great Eruption and the surrounding Homunculus nebula ejected in that event. The cause of this eruption has been the centre of a long-standing mystery. Recent observations, including light-echo spectra of the eruption, suggest that it most likely resulted from a stellar merger in an unstable triple system. Here we present a detailed set of theoretical calculations for this scenario; from the dynamics of unstable triple systems and the mass ejection from close binary encounters, to the mass outflow from the eruption caused by the stellar merger and the post-merger wind phase. In our model the bipolar post-merger wind is the primary agent for creating the Homunculus, as it sweeps up external eruption ejecta into a thin shell. Our simulations reproduce many of the key aspects of the shape and kinematics of both the Homunculus nebula and its complex surrounding structure, providing strong support for the merger-in-a-triple scenario.