The 56-year-old, who steered Bayern to last season’s treble which included the Champions League title, said his players already knew.
“I told the team that I informed the club during the week that I want out of my contract at the end of the season,” Flick said.
“It was not an easy decision for me.”
The shock news caps a turbulent week for Bayern who were knocked out of the Champions League on Tuesday by Paris Saint-Germain.
Tensions have been simmering behind the scenes between Flick and Bayern sports director Hasan Salihamidzic over player recruitment.
“I have discussed things internally with those responsible. The reasons will remain internal for now,” added Flick, who said he made his decision after “careful consideration”.
The rift was triggered after Salihamidzic confirmed Jerome Boateng will not be kept on next season. Flick made it clear he wanted to keep the 32-year-old centre-back.
Being released from his Bayern contract would clear the way for Flick to take charge of Germany after Euro 2020.
Flick is one of the main candidates to be Germany head coach after Joachim Loew steps down following the June 11-July 11 tournament.
Flick says taking charge of the German national team is “an option” but he has yet to speak to Germany team director Oliver Bierhoff who will ultimately decide.
Flick was Loew’s assistant coach when Germany won the 2014 World Cup title in Brazil.