We combine high-resolution HST/WFC3 images with multi-wavelength photometry to track the evolution of structure and activity of massive (log(M*) > 10) galaxies at redshifts z = 1.4 - 3 in two fields of the Cosmic Assembly Near-infrared Deep Extragalactic Legacy Survey (CANDELS). We detect compact, star-forming galaxies (cSFGs) whose number densities, masses, sizes, and star formation rates qualify them as likely progenitors of compact, quiescent, massive galaxies (cQGs) at z = 1.5 - 3. At z > 2 most cSFGs have specific star-formation rates (sSFR = 10^-9 yr^-1) half that of typical, massive SFGs at the same epoch, and host X-ray luminous AGN 30 times (~30%) more frequently. These properties suggest that cSFGs are formed by gas-rich processes (mergers or disk-instabilities) that induce a compact starburst and feed an AGN, which, in turn, quench the star formation on dynamical timescales (few 10^8 yr). The cSFGs are continuously being formed at z = 2 - 3 and fade to cQGs by z = 1.5. After this epoch, cSFGs are rare, thereby truncating the formation of new cQGs. Meanwhile, down to z = 1, existing cQGs continue to enlarge to match local QGs in size, while less-gas-rich mergers and other secular mechanisms shepherd (larger) SFGs as later arrivals to the red sequence. In summary, we propose two evolutionary scenarios of QG formation: an early (z > 2), fast-formation path of rapidly-quenched cSFGs that evolve into cQGs that later enlarge within the quiescent phase, and a slow, late-arrival (z < 2) path for SFGs to form QGs without passing through a compact state.