The gravitational waves from the first binary neutron star merger, GW170817, were accompanied by a multiwavelength electromagnetic counterpart, from γ-rays to radio. The accompanying γ-rays seem at first to confirm the association of mergers with short gamma-ray bursts (sGRBs). The common interpretation was that we see an emission from an sGRB jet seen off-axis. However, a closer examination of the subluminous γ-rays and the peculiar radio afterglow was inconsistent with this simple interpretation. Here we present results of 3D and 2D numerical simulations that follow the hydrodynamics and emission of the outflow from a neutron star merger, form its ejection and up to its deceleration by the circum-merger medium. Our results show that the current set of γ-rays, X-rays, and radio observations can be explained by the emission from a mildly relativistic cocoon material (Lorentz factor ~2–5) that was formed while a jet propagated through the material ejected during the merger. The γ-rays are generated when the cocoon breaks out from the engulfing ejecta, while the afterglow is produced by interaction of the cocoon matter with the interstellar medium. The strong early UV/optical signal may be a Lorentz-boosted macronova/kilonova. The fate of the jet itself is currently unknown, but our full-electromagnetic (EM) models define a path to resolving between successful and choked jet scenarios, outputting coupled predictions for the image size, morphology, observed time-dependent polarization, and light-curve behavior from radio to X-ray. The predictive power of these models will prove key in interpreting the ongoing multifaceted observations of this unprecedented event