Branagh previously directed and starred in the 1996 film version of the Shakespearean tragedy.
He directed Law in the 2007 movie "Sleuth" and the two were slated to collaborate on a West End production of "Hamlet" in June 2009.
The BBC said Branagh dropped out of the project due to a conflict with his shooting schedule for the superhero movie "Thor." He has been replaced as "Hamlet" director by Michael Grandage, the artistic director of the Donmar Warehouse, the BBC said.
"We have arrived at this arrangement very amicably," Grandage told the BBC, adding the play will open as scheduled next year.
"I feel privileged to be part of the Donmar West End season and to be directed by the company's artistic director Michael Grandage," said Law. "It was Ken who brought me to this project. With his support and guidance, as one of the greatest Hamlets of all time, and with Michael directing, I can't imagine a better scenario for me, as an actor, to undertake the role."
Notable deaths of 2014 [PHOTOS]