Intrinsic Alignments of Galaxies: analytic and deep machine learning studies in cosmological simulations