The answer’s quite simple. Director Duncan Jones just
asked and she said yes.

"I’m very fortunate that I’m very
slowly but surely getting to a point in my career where I can
invite people that I’m a huge fan of to sort of come and do
things like that," director Duncan Jones tells Tech Insider.
"I was able to get Kevin Spacey to work on my first film, 'Moon.'
I was able to get Scott Bakula to come and do a cameo for 'Source
Code,' and now, obviously I had the chance to get Glenn Close to
come in and do a cameo on this film."

Close goes uncredited in the
film, though IMDB credits her as
Alodi, a
half-elven male guardian in the series' universe, meaning the
movie flipped the character's gender.

"It’s just one of those little
enjoyable luxuries of being a director on a movie is you get to
work with the people you rally admire," Jones adds. "She knew I
was a fan of hers and she likes my movies and was willing to come
and do a day of work with us."

It’s not clear whether Close is a "Warcraft" fan, too, but
that could also be a possibility.