McAvoy was born on 21 April 1979 in Glasgow, Scotland, to James, a bus driver, and Elizabeth (née Johnstone), a nurse. He was raised on a housing estate in Drumchapel, Glasgow by his maternal grandparents (James, a butcher, and Mary), after his parents divorced when James was 11. He went to St Thomas Aquinas Secondary in Jordanhill, Glasgow, where he did well enough and started 'a little school band with a couple of mates'.
McAvoy toyed with the idea of the Catholic priesthood as a child but, when he was 16, a visit to the school by actor David Hayman sparked an interest in acting. Hayman offered him a part in his film The Near Room (1995) but despite enjoying the experience McAvoy didn't seriously consider acting as a career, although he did continue to act as a member of PACE Youth Theatre. He applied instead to the Royal Navy and had already been accepted when he was also offered a place at the Royal Scottish Academy of Music and Drama (RSAMD).
He took the place at the RSAMD (now the Royal Conservatoire of Scotland) and, when he graduated in 2000, he moved to London. He had already made a couple of TV appearances by this time and continued to get a steady stream of TV and movie work until he came to attention of the British public in 2004 playing car thief Steve McBride in the successful UK TV series Shameless (2004) and then to the rest of the world in 2005 as Mr Tumnus, the faun, in Disney's adaptation of C. S. Lewis's The Chronicles of Narnia: The Lion, the Witch and the Wardrobe (2005). In The Last King of Scotland (2006) McAvoy portrayed a Scottish doctor who becomes the personal physician to dictator Idi Amin, played by Forest Whitaker. McAvoy's career breakthrough came in Atonement (2007), Joe Wright's 2007 adaption of Ian McEwan's novel.
Since then, McAvoy has taken on theatre roles, starring in Shakespeare's 'Macbeth' (directed by Jamie Lloyd), which launched the first Trafalgar Transformed season in London's West End and earned him an Olivier award nomination for Best Actor. In January 2015, McAvoy returned to the Trafalgar Studios stage to play Jack Gurney, the delusional 14th Earl of Gurney who believes he is Jesus, in the first revival of Peter Barnes's satire 'The Ruling Class', a role for which he was subsequently awarded the London Evening Standard Theatre Award's Best Actor.
On screen, McAvoy has appeared as corrupt cop Bruce Robertson in Filth (2013), a part for which he received a Scottish BAFTA for Best Actor, a British Independent Film Award for Best Actor, a London Critics Circle Film Award for British Actor of the Year and an Empire Award for Best Actor. More recently, he reprised his role as Professor Charles Xavier in X-Men: Days of Future Past (2014), X-Men: Apocalypse (2016) and X-Men: Dark Phoenix (2019). He began his depiction of Kevin Wendell Crumb, also known as The Horde, a man with an extreme case of dissociative identity disorder in M. Night Shyamalan's thriller Split (2016) and continued it in the sequel, Glass (2019). Also in 2019, he played Bill Denbrough in It Chapter Two (2019), the horror sequel to It (2017).
McAvoy and Jamie Lloyd look set to continue their collaboration in December 2019, with a production of 'Cyrano de Bergerac' at the Playhouse Theatre in the West End, London. The project has been on the cards as long ago as 2017, when McAvoy posted a picture of him reading the script and wearing a false nose.