  We examine the fraction of massive ($M_{*}>10^{10} M_{\odot}$), compact
star-forming galaxies (cSFGs) that host an active galactic nucleus (AGN) at
$z\sim2$. These cSFGs are likely the direct progenitors of the compact
quiescent galaxies observed at this epoch, which are the first population of
passive galaxies to appear in large numbers in the early Universe. We identify
cSFGs that host an AGN using a combination of Hubble WFC3 imaging and Chandra
X-ray observations in four fields: the Chandra Deep Fields, the Extended Groth
Strip, and the UKIDSS Ultra Deep Survey field. We find that
$39.2^{+3.9}_{-3.6}$\% (65/166) of cSFGs at $1.4<z<3.0$ host an X-ray detected
AGN. This fraction is 3.2 times higher than the incidence of AGN in extended
star-forming galaxies with similar masses at these redshifts. This difference
is significant at the $6.2\sigma$ level. Our results are consistent with models
in which cSFGs are formed through a dissipative contraction that triggers a
compact starburst and concurrent growth of the central black hole. We also
discuss our findings in the context of cosmological galaxy evolution
simulations that require feedback energy to rapidly quench cSFGs. We show that
the AGN fraction peaks precisely where energy injection is needed to reproduce
the decline in the number density of cSFGs with redshift. Our results suggest
that the first abundant population of massive, quenched galaxies emerged
directly following a phase of elevated supermassive black hole growth and
further hints at a possible connection between AGN and the rapid quenching of
star formation in these galaxies.
