McGill, ranked 21 in the world, reached the semi-finals in Sheffield in 2020 and has beaten Ronnie O’Sullivan, Mark Selby and Shaun Murphy at the Crucible.
Trump, the 2019 champion and last year’s losing finalist, suffered his first defeat in the opening round since he lost to Rory McLeod in 2017.
The fifth seed trailed 6-3 going into the concluding session but soon reduced that deficit to 6-5, with breaks of 68 and 58.
In frame 12 he led 40-0 when he ran out of position, and Scotland’s McGill made him pay.
The Englishman hit back to take the 13th to make it 7-6 at the interval, only for his opponent to dominate the next two frames.
McGill, 32, made 45 in frame 16 before missing the black, but Trump potted just one red then missed the black himself, and McGill added 30 for victory.
“I didn’t feel amazing but I played well enough to capitalise,” said McGill. “It doesn’t matter how bad Judd plays, his standard is such that he can’t play that badly, but he wasn’t at his best.”
Trump said he had been “very rusty” this season.
“I just missed too many easy balls,” said the 33-year-old. “I had loads of chances in today’s session but I couldn’t take them, and you can’t expect to play like that and win in the World Championship.”
Earlier, 2020 runner-up Kyren Wilson produced the first maximum 147 break of this year’s tournament in his opening-round match against Ryan Day.