The 59-year-old will leave Bayern, one year before his contract was due to expire.
Van Gaal won the double in his first season at Bayern and reached the Champions League final in 2011, but the German club have struggled this season.
“The reason is differing views on the club’s strategic direction,” the club said in a statement.