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 θ 2D can be well described by a truncated shifted exponential distribution with only 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 θ 2D distribution, with only a small bias (<3°) possibly arising from unaccounted for couplings between θ 2D and other factors. We find that both the 2D and 3D misalignment angles θ 2D and θ 3D decrease with ex situ stellar mass fraction F acc, halo mass M vir, and stellar mass M *, while increasing with the disk-to-total stellar mass fraction F disk and redshift. These dependences are in good agreement with our recent observational study based on BOSS galaxy samples. Our results suggest that F acc is a key factor in determining galaxy–halo alignment. Grouping galaxies by F acc nearly eliminates the dependence of θ 3D on M vir for all three principle axes, and also reduces the redshift dependence. For θ 2D, we find a more significant redshift dependence than for θ 3D even after controlling F 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.