The New Horizons spacecraft's encounter with the cold classical Kuiper Belt object (486958) Arrokoth (provisional designation 2014 MU69) revealed a contact-binary planetesimal. We investigate how Arrokoth formed, finding it is the product of a gentle, low-speed merger in the early Solar System. Its two lenticular lobes suggest low-velocity accumulation of numerous smaller planetesimals within a gravitationally collapsing cloud of solid particles. The geometric alignment of the lobes indicates they were a co-orbiting binary that experienced angular momentum loss and subsequent merger, possibly due to dynamical friction and collisions within the cloud or later gas drag. Arrokoth's contact-binary shape was preserved by the benign dynamical and collisional environment of the cold classical Kuiper Belt, so informs the accretion processes that operated in the early Solar System.