The Lord of the Rings star will play the role of Prospero from William Shakespeare's classic play The Tempest at the science-themed curtain-raising spectacular at the Olympic Stadium.
Professor Hawking is also scheduled to appear live to serve as the "guide" for the event, which will feature disabled performers and more than 3,000 volunteers.
Artistic director Jenny Sealey says, "You will be taken on the most exquisite journey of discovery inspired by the wonder of science. Both Hawking and McKellen in their narrative talk about what we all need to remember: don't just look down at your feet, look at the stars, be curious."
Fellow artistic director Bradley Hemmings reveals Hawking agreed to join the show last year (11), adding, "Everybody knows about Professor Hawking and his extraordinary theoretical work and writings about science which have made very complex ideas accessible to all of us, but what came through in our meetings with him was the humanity and the humour of him. He is a fun guy."
Meanwhile, actor and theatre director Mark Rylance has also organised a series of Shakespeare-inspired 'flashmobs' across London to mark the start of the sporting event for physically disabled athletes.