Heteroepitaxial growth of aluminum nitride (AIN) has been explored by experiments, but the corresponding growth mechanism is still unrevealed. Here, we use molecular dynamics simulations to study effects of temperature and N : Al flux ratio on deposited AlN. When the temperature increases from 1000 K to 2000 K with an N : Al flux ratio of 2.0, the growth rate of the AlN film decreases. The crystallinity of the deposited AlN is distinctly improved as the temperature increases from 1000 K to 1800 K and it becomes saturated between 1800 K and 2000 K. The crystallinity of the deposited film at 1800 K increases with an increase in the N : Al flux ratio from 0.8 to 2.4, and this degraded a little at an N : Al flux ratio of 2.8. In addition, stoichiometry is closely related to crystallinity of deposited films. Film with good crystallinity is connected with a near 50% N fraction. Furthermore, the average mean biaxial stress and mean normal stress at 1800 K with N : Al flux ratios of 2.0, 2.4 and 2.8 are calculated, indicating that the deposited film with lowest stress has the best crystal quality and the defects appear where stresses occur.