The charge-density wave (CDW) mechanism and resulting structure of the AV3Sb5 family of kagome metals has posed a puzzling challenge since their discovery four years ago. In fact, the lack of consensus on the origin and structure of the CDW hinders the understanding of the emerging phenomena. Here, by employing a non-perturbative treatment of anharmonicity from first-principles calculations, we reveal that the charge-density transition in CsV3Sb5 is driven by the large electron-phonon coupling of the material and that the melting of the CDW state is attributed to ionic entropy and lattice anharmonicity. The calculated transition temperature is in very good agreement with experiments, implying that soft mode physics are at the core of the charge-density wave transition. Contrary to the standard assumption associated with a pure kagome lattice, the CDW is essentially three-dimensional as it is triggered by an unstable phonon at the L point. The absence of involvement of phonons at the M point enables us to constrain the resulting symmetries to six possible space groups. The unusually large electron-phonon linewidth of the soft mode explains why inelastic scattering experiments did not observe any softened phonon. We foresee that large anharmonic effects are ubiquitous and could be fundamental to understand the observed phenomena also in other kagome families.