Zidane, 45, replaced Rafael Benitez in January 2016 and despite his European success has come under pressure for winning only one La Liga title during his two and a half years in charge.
He told Real president Florentino Perez he would be leaving on Wednesday before informing captain Sergio Ramos.
“I know it is a strange moment for everyone involved,” said Zidane. “But it had to be done for everybody.
“This team has to continue winning and need a change. After three years they need a new voice, a new way of saying things – possibly another way of working.
“That’s why I’ve taken that decision. I love this club, I love the president, he’s given me the chance to come as a player and a manager. I’m eternally grateful to him but today for me and for everyone we have to change.”
Perez said Zidane’s decision was completely unexpected after the club’s 13th Champions League title last weekend.
“It is a sad day for me and will be for the fans, the players and everyone at the club,” said Perez. “I wanted him to be next to me forever. But I know it is his final decision.
“I would have liked to convince him to stay on but I know what he is like.”
In January this year, Zidane confirmed he signed a contract extension at Real to keep him at the club until 2020 but just a month later said “when I feel there is nothing more to give, I’ll walk away”.
Gareth Bale, who scored twice in Real’s 3-1 win over Liverpool in Saturday’ Champions League final, and Cristiano Ronaldo have both cast doubts on their future at the Bernabeu since lifting the trophy.
Zidane opted to rest Ronaldo more in his final season in charge, while Bale became frustrated with limited first-team opportunities.
“I had the respect of all, above all the players, which has been fundamental in achieving things,” Zidane added. “The players have nothing to do with my decision, it is about what I think.”
Zidane, who was applauded by journalists in Spain as he left his news conference, denied his decision has anything to do with a Ronaldo ‘crisis’.