The president had repeatedly criticised his top law enforcement official after he recused himself from the Russia investigation dogging the White House.
Mr Trump said Mr Sessions will be temporarily replaced by his chief of staff, Matthew Whitaker, who has criticised the Russia inquiry.
In a resignation letter, Mr Sessions – a former Alabama senator who was an early supporter of Mr Trump – made clear the decision to go was not his own.
“Dear Mr President, at your request I am submitting my resignation,” he wrote in an undated letter.
“Most importantly, in my time as attorney general, we have restored and upheld the rule of law,” Mr Sessions added, while thanking the Republican president.
According to a White House official, Mr Trump’s Chief of Staff John Kelly called Mr Sessions on Wednesday before Mr Trump held a press conference to discuss mid-term election results.