It has been agreed that Ms Dick will continue to serve for a short period to enable an orderly handover.
The commissioner has faced a series of scandals during her time in leading Britain’s biggest police force – most recently concerning violently racist, misogynist and homophobic messages by officers at Charing Cross police station, which were published by a watchdog.
It is understood Ms Dick submitted a plan for reforming the force but Mr Khan did not think it met what was required, and called her in for a meeting at 4.30pm on Thursday.
But she did not attend and submitted her resignation instead.
Mr Khan did not inform Home Secretary Priti Patel of his intention to request a meeting with the commissioner, the PA news agency understands.
Home Office sources say Ms Patel was not impressed by this and thought it was “rude and unprofessional”.
She will oversee the appointment of the new commissioner in due course.
"I’d like to thank Dame Cressida for the nearly four decades of her life that she has devoted to serving the public, latterly as Commissioner of the Metropolitan Police," Ms Patel said.
“She would be the first to say that she has held the role during challenging times, yet for nearly five years she has undertaken her duties with a steadfast dedication to protecting our capital city and its people, including during the unprecedented period of the pandemic.
“Leading the Met has also involved driving our national counter-terrorism capability at a time of multiple threats while, as the first woman to hold the post, she has exemplified the increasingly diverse nature of our police and demonstrated that all can aspire to hold leadership roles in policing in this country today.”
UK Prime Minister Boris Johnson said on Twitter: "Dame Cressida has served her country with great dedication and distinction over many decades. I thank her for her role protecting the public and making our streets safer."
Rank and file officers reacted with sadness. The chairman of the Metropolitan Police Federation, Ken Marsh, said she had been treated unfairly, while the Home Office was reportedly not told in advance of her departure.
“We are deeply saddened by the resignation of our commissioner,' Mr Marsh said. "She was much loved across the rank and file of the Metropolitan Police Service.
“We feel the way she has been treated is wholly unfair and we did believe that she was the person who could take us through this and bring us out the other side.”
The apparent support from officers was not reflected by various critics, including women’s rights group Reclaim These Streets, which tweeted: “Good riddance.”
The force has been dogged by controversies, including heavy criticism over its apparent hesitation to launch an investigation into parties held in Downing Street and the Cabinet Office during lockdown.
There was fury over the rape and murder of Sarah Everard by a serving officer, and the force’s actions following her death in tackling a vigil held in her memory during coronavirus restrictions, and issuing clumsy advice telling women in trouble to flag down a passing bus. That advice was later retracted.
Last summer the Euro 2020 final at Wembley was marred by a massive security lapse in which thousands of ticketless fans were able to storm the stadium.
And the notorious 1987 unsolved axe murder of private investigator Daniel Morgan in a pub car park also hit the headlines, with an independent panel accusing the Metropolitan Police of institutional corruption over the case.
His brother Alastair said she had “disappointed” his family since he first met her in 2012.
Mr Morgan, who has campaigned for decades for justice for his brother, said: “Although I think it is a shame that we are seeing another commissioner disappear under a cloud of smoke, it is necessary.”
On Thursday evening, in a shock statement, Ms Dick announced she was stepping down from the job, despite hours earlier having insisted she had no intention of going.
“It is with huge sadness that following contact with the mayor of London today, it is clear that the mayor no longer has sufficient confidence in my leadership to continue," she said.
“He has left me no choice but to step aside as Commissioner of the Metropolitan Police Service.”
Hours earlier, she told the BBC: “I have absolutely no intention of going and I believe that I am and have been, actually for the last five years, leading a real transformation in the Met.”
Mr Khan this week indicated that Ms Dick's future hung in the balance over her response to problems with the culture in the Met, and how to restore the public’s confidence in the force.
On Thursday he said: “Last week, I made clear to the Metropolitan Police Commissioner the scale of the change I believe is urgently required to rebuild the trust and confidence of Londoners in the Met and to root out the racism, sexism, homophobia, bullying, discrimination and misogyny that still exists.
“I am not satisfied with the commissioner’s response. On being informed of this, Dame Cressida Dick has said she will be standing aside.
“It’s clear that the only way to start to deliver the scale of the change required is to have new leadership right at the top of the Metropolitan Police.
“I will now work closely with the Home Secretary on the appointment of a new commissioner so that we can move quickly to restore trust in the capital’s police service while keeping London safe."