"At your request, I am submitting my resignation," Sessions wrote in an undated letter to the president.
"Since the day I was honored to be sworn in as Attorney General of the United States, I came to work at the Department of Justice every day determined to do my duty and serve my country," Sessions wrote. "I have done so to the best of my ability, working to support the fundamental legal processes that are the foundation of justice."
On Twitter, Trump thanked Sessions for his service and announced Whitaker will serve as acting attorney general and that a permanent replacement will take place at a later date.
Whitaker in a statement called Sessions as a dedicated public servant and said he is committed to leading the Justice Department with the "highest ethical standards."
"It is a true honor that the President has confidence in my ability to lead the Department of Justice as Acting Attorney General. I am committed to leading a fair Department with the highest ethical standards, that upholds the rule of law, and seeks justice for all Americans. I will work with our colleagues in Federal, State, local, and tribal leadership, including our partners in law enforcement and our U.S. Attorneys, to ensure the safety of all Americans and the security of the nation," the statement read. "Attorney General Sessions has been a dedicated public servant for over 40 years. It has been a privilege to work under his leadership. He is a man of integrity who has served this nation well."
Sessions left the Justice Department Wednesday afternoon after meeting with staff. About 150 people, including many longtime career attorneys, clapped as he walked out, gave him a thumbs up, and shook hands.
During a lengthy press conference Wednesday morning, Trump declined to say what staff changes he had planned, but said it was "no great secret" that "a lot of administrations make changes after midterms." Trump was specifically asked by a reporter about chief of staff John Kelly.
"I will say that for the most part, I'm very, very happy with this cabinet," Trump said.
Senate Majority Leader Mitch McConnell wished Sessions well after learning of his resignation Wednesday afternoon.
"I thank Jeff Sessions for his dedicated service as Attorney General. Throughout his career, as a prosecutor, a Senator and as Attorney General, he remained steadfast in his commitment to the rule of law and his love of our great nation. I wish him well and look forward to working with him in any future endeavors," McConnell said.
But House Minority Leader Nancy Pelosi slammed the move as an attempt to quash the Russia probe.
"It is impossible to read Attorney General Sessions’ firing as anything other than another blatant attempt by @realDonaldTrump to undermine & end Special Counsel Mueller’s investigation," Pelosi tweeted. "Given his record of threats to undermine & weaken the Russia investigation, Matthew Whitaker should recuse himself from any involvement in Mueller’s investigation. Congress must take immediate action to protect the rule of law and integrity of the investigation. #FollowTheFacts."
But Democratic Rep. Elijah E. Cummings, the ranking member of the House Committee on Oversight and Government Reform, called for an investigation into the timing of Sessions' resignation.
"There are many, many reasons to remove Attorney General Sessions -- from his failure to disclose his communications with the Russians to his inhumane policy of separating children from their parents at the border -- but one reason that is not acceptable is to interfere with or obstruct the Mueller investigation," Cummings said.
"President Trump waited until just hours after the midterm elections to make this move, which had been rumored for months. Congress must now investigate the real reason for this termination, confirm that Acting Attorney General Matthew Whitaker is recused from all aspects of the Special Counsel’s probe, and ensure that the Department of Justice safeguards the integrity of the Mueller investigation," Cummings added.
Rep. Jerry Nadler, the ranking member of the House Judiciary Committee, also called for accountability.
"Americans must have answers immediately as to the reasoning behind @realDonaldTrump removing Jeff Sessions from @TheJusticeDept. Why is the President making this change and who has authority over Special Counsel Mueller’s investigation? We will be holding people accountable," Nadler tweeted.
A DOJ spokeswoman said that Whitaker does not need to be sworn in and is therefore already the acting attorney general.
Tensions developed between Trump and Sessions in March 2017, when Sessions recused himself from the Russia investigation and Deputy Attorney General Rod Rosenstein took over.
Rosenstein soon appointed Special Counsel Robert Mueller to oversee the Russia probe, angering the president.
Federal law makes clear that a special counsel is overseen by the attorney general, so Whitaker will now oversee the probe. Whitaker has publicly criticized the probe in the past, including in an August 2017 op-ed for CNN.
"I've prosecuted several financial crimes at the federal level and I've also defended plenty in my private practice. From this unique vantage point, I can understand how a motivated prosecutor, in a broad investigation into the financial affairs of high-profile individuals, can become overzealous toward the targets of such probes -- with calamitous results," Whitaker wrote at the time. "While no one is above the law, in situations such as this, any seasoned prosecutor must use discretion both judiciously and expertly."
"It is time for Rosenstein, who is the acting attorney general for the purposes of this investigation, to order Mueller to limit the scope of his investigation to the four corners of the order appointing him special counsel," Whitaker added.
Following Sessions' resignation, Senate Minority Leader Chuck Schumer called on Whitaker to recuse himself from the probe.
"Given his previous comments advocating defunding and imposing limitations on the Mueller investigation, Mr. Whitaker should recuse himself from its oversight for the duration of his time as acting attorney general," Schumer said in a statement.
Schumer later tweeted that: "Clearly, the President has something to hide."
Previously, Trump would not say whether Sessions -- who he has repeatedly criticized throughout his tenure -- would be safe in his job after the midterm elections.
"I just would love to have him do a great job," Trump told Bloomberg News on Aug. 30.
"I’d love to have him look at the other side," Trump added, underscoring his demand for Sessions to reopen the investigation into Hillary Clinton and the origins of the Russia investigation.
Earlier in August, in an interview with Fox News, Trump lashed out at Sessions, saying he failed to take control of the Department of Justice.
In his most forceful public rebuke to date, Sessions hit back shortly after, saying he "will not be improperly influenced by political considerations."
Sen. Lindsey Graham of South Carolina, a close Trump confidante, predicted Sessions would be out of his job in the near future, but insisted Trump should wait until after November's midterm elections.
"The president’s entitled to an attorney general he has faith in, somebody that’s qualified for the job, and I think there will come a time, sooner rather than later, where it will be time to have a new face and a fresh voice at the Department of Justice," Graham said at the time. "Clearly, Attorney General Sessions doesn’t have the confidence of the president."
Trump repeatedly called on Sessions to end the Russia probe on Twitter and TV interviews.
"..This is a terrible situation and Attorney General Jeff Sessions should stop this Rigged Witch Hunt right now, before it continues to stain our country any further. Bob Mueller is totally conflicted, and his 17 Angry Democrats that are doing his dirty work are a disgrace to USA!" Trump tweeted on Aug. 1.
Sessions was the first sitting U.S. senator to endorse then-candidate Trump.
Sessions parlayed that support to become attorney general, a role he held at the state level in Alabama.
The president's priorities and Sessions' mirrored each other. Both tough on immigration, the opioid crisis, and crime, both men have a pro-law enforcement perspective.
Aside from the president lashing out at him, Sessions' tenure as attorney general has largely been focused on carrying out the policies of the administration and most notably, the zero-tolerance immigration policy which lead to the separation of families on the U.S.-Mexico border.
When Sessions announced the policy in May, he warned those coming to the country illegally that the administration would prosecute them.
"I have put in place a 'zero tolerance' policy for illegal entry on our Southwest border. If you cross this border unlawfully, then we will prosecute you. It’s that simple. If you smuggle illegal aliens across our border, then we will prosecute you. If you are smuggling a child, then we will prosecute you and that child will be separated from you as required by law," he said at an event in San Diego.
The policy was criticized by Democrats and Republicans alike.
Sessions also sent more judges and prosecutors to the southern border to help with processing illegal border crossers.
In his resignation letter, Sessions described restoring and upholding the "rule of law" as his most important legacy as attorney general. "We have operated with integrity and have lawfully and aggressively advanced the policy agenda of this administration," Sessions wrote.
He called his work implementing the "law enforcement agenda based on the rule of law" a "central part" of Trump's campaign for presidency.
Sessions also thanked the "fabulous men and women in law enforcement," calling it his greatest honor to serve alongside them.
The attorney general also focused on pro-law enforcement priorities and often echoed the president in touting law enforcement's objectives.
"Let me say this loud and clear: as long as I am the Attorney General of the United States, the Department of Justice will have the back of all honest and honorable law enforcement officers," Sessions said at the 25th Annual Top Cops Awards in May.
Sessions was also a regular steward for rigorous opioid prosecution. Just recently, in Cleveland, Sessions announced four opioid cases, each targeting the selling and distribution of opioids, something that he stressed was important to the president.
ABC News' Luke Barr, Julia Jacobo and Benjamin Siegel contributed to this report.
This is a developing story. Check back for updates.