  We investigate the alignment of galaxy and halo orientations using the
TNG300-1 hydrodynamical simulation. Our analysis reveals that the distribution
of the 2D misalignment angle $\theta_{\rm{2D}}$ can be well described by a
truncated shifted exponential (TSE) distribution with only {\textit{one}} free
parameter across different redshifts and galaxy/halo properties. We demonstrate
that the galaxy-ellipticity (GI) correlations of galaxies can be reproduced by
perturbing halo orientations with the obtained $\theta_{\rm{2D}}$ distribution,
with only a small bias ($<3^{\circ}$) possibly arising from unaccounted
couplings between $\theta_{\rm{2D}}$ and other factors. We find that both the
2D and 3D misalignment angles $\theta_{\rm{2D}}$ and $\theta_{\rm{3D}}$
decrease with ex situ stellar mass fraction $F_{\rm{acc}}$, halo mass
$M_{\rm{vir}}$ and stellar mass $M_{*}$, while increasing with disk-to-total
stellar mass fraction $F_{\rm{disk}}$ and redshift. These dependences are in
good agreement with our recent observational study based on the BOSS galaxy
samples. Our results suggest that $F_{\rm{acc}}$ is a key factor in determining
the galaxy-halo alignment. Grouping galaxies by $F_{\rm{acc}}$ nearly
eliminates the dependence of $\theta_{\rm{3D}}$ on $M_{\rm{vir}}$ for all three
principle axes, and also reduces the redshift dependence. For
$\theta_{\rm{2D}}$, we find a more significant redshift dependence than for
$\theta_{\rm{3D}}$ even after controlling $F_{\rm{acc}}$, which may be
attributed to the evolution of galaxy and halo shapes. Our findings present a
valuable model for observational studies and enhance our understanding of
galaxy-halo alignment.
