McMillan was born in Edinburgh, Midlothian, and brought up in Loanhead, a small mining and farming village at the base of the Pentland Hills. He attended Lasswade High School, where he graduated with the Marshall Memorial medal. He then studied for a bachelor's degree in chemistry at the University of Edinburgh. After graduating, McMillan moved to Arizona State University, where he researched geochemistry with John Holloway and Alexandra Navrotsky. His doctoral research was in using vibrational spectroscopy to investigate the structures of silicate glasses.