Bajevic, who has come under severe criticism in the last week from the club's hard core fans and Brazilian forward Rivaldo, resigned after a board meeting at which the subject of the coach's position had not even been raised.
"I believe that unity in a team is the most important ingredient for its success. By staying with Olympiakos, the team would not have that next season," Bajevic, who had taken charge at the start of the season, said in a statement.
The Serbian-born Bajevic said he did not want any financial compensation from the club and added that he had not been able to live up to the club's desire for success in Europe.
Greek Super League
Greece caught up in match-fixing investigation
"Maybe my powers were not enough to fulfil the European dream that they want so much at Olympiakos," he said.
Olympiakos won each of their home Champions League matches last season but a 3-1 defeat at Anfield to eventual winners Liverpool in the final pool game knocked them out.
At the weekend the supporters of Gate 7, the team's organised fan club, released a statement calling for Bajevic's dismissal although a poll conducted for SportDay newspaper on Wednesday showed a 68 percent approval rating for the coach with only 28.5 percent wanting him to go.
Meanwhile, Rivaldo also denounced Bajevic on national television at the weekend.
"What we need to decide is whether we want a coach with a Greek mentality or one with a European mentality, one with objectives in Europe and not just here," the Brazil World Cup striker said.
Javier Irureta, until Tuesday coach of Deportivo Coruna, one of Rivaldo's former teams, is being mooted as a likely replacement.
Manchester United need to pay £60m for Varane - Paper Round
'We were simply unlucky' - Tuchel on Chelsea's FA Cup final defeat to Leicester