The New Horizons spacecrafts encounter with the cold classical Kuiper belt object (486958) Arrokoth (formerly 2014 MU69) revealed a contact-binary planetesimal. We investigate how it 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, solid particle cloud. The geometric alignment of the lobes indicates the lobes 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. Arrokoths contact-binary shape was preserved by the benign dynamical and collisional environment of the cold classical Kuiper belt, and so informs the accretion processes that operated in the early Solar System.