Binary neutron-star mergers (BNSMs) are among the most readily detectable gravitational-wave (GW) sources with the Laser Interferometer Gravitational-wave Observatory (LIGO). They are also thought to produce short gamma-ray bursts (SGRBs) and kilonovae that are powered by r-process nuclei. Detecting these phenomena simultaneously would provide an unprecedented view of the physics during and after the merger of two compact objects. Such a Rosetta Stone event was detected by LIGO/Virgo on 2017 August 17 at a distance of similar to 44 Mpc. We monitored the position of the BNSM with Atacama Large Millimeter/submillimeter Array (ALMA) at 338.5 GHz and the Giant Metrewave Radio Telescope (GMRT) at 1.4 GHz, from 1.4 to 44 days after the merger. Our observations rule out any afterglow more luminous than 3 x 10(26) erg s(-1) Hz(-1) in these bands, probing >2-4 dex fainter than previous SGRB limits. We match these limits, in conjunction with public data announcing the appearance of X-ray and radio emission in the weeks after the GW event, to templates of off-axis afterglows. Our broadband modeling suggests that GW170817 was accompanied by an SGRB and that the gamma-ray burst (GRB) jet, powered by E-AG,E- iso similar to 10(50) erg, had a half-opening angle of similar to 20 degrees, and was misaligned by similar to 41 degrees from our line of sight. The data are also consistent with a more collimated jet: E-AG,E- iso similar to 10(51) erg, theta(1/2,jet) similar to 5 degrees, theta(obs) similar to 17 degrees. This is the most conclusive detection of an off-axis GRB afterglow and the first associated with a BNSM-GW event to date. We use the viewing angle estimates to infer the initial bulk Lorentz factor and true energy release of the burst.