The classic text which popularized ARIMA modelling was Box and Jenkins (1970). The most recent edition is Box et al. (2015), and it is still an excellent reference for all things ARIMA. Brockwell and Davis (2016) provides a good introduction to the mathematical background to the models, while Peña, Tiao, and Tsay (2001) describes some alternative automatic algorithms to the one used by auto.arima().