Anderson made his debut in 2003 and has taken 700 wickets in 187 Tests – the most by any pace bowler in Test history.
He is third on the all-time list of wicket-takers in Tests behind spinners Muttiah Muralitharan of Sri Lanka and Australia’s Shane Warne.
It is not clear whether he will continue to play for his county, Lancashire.
“It has been an incredible 20 years representing my country, playing the game I’ve loved since I was a kid,” Anderson said.
“I’m excited for the new challenges that lie ahead, as well as filling my days with even more golf.
“Thank you to everyone who has supported me over the years, it’s always meant a lot, even if my face often doesn’t show it.”
Richard Thompson, the chair of the England and Wales Cricket Board, said English cricket owes Anderson a “send-off like no other”.
“I don’t think we’ll ever see a bowler to match Jimmy again,” he said. “It has been an honour as an England fan to watch him, and to marvel at his skill with the ball.
“To still be bowling at the top of his game at 41 is remarkable, and he is a true inspiration and role model for peers and younger generations alike.
“His final Test promises to be an emotional one and, having been there for his first Test in 2003, it will be an honour to watch his final one at Lord’s in July.”