Mr Erdogan was in Germany for a three-day official visit, in an effort to repair ties between Ankara and Berlin.
But things turned sour when he accused Berlin of harbouring terrorists, those present have said.
Several opposition politicians did not attend the dinner on Friday, including German chancellor Angela Merkel.
Mr Erdogan’s visit comes amid strained relations between Germany and Turkey, after the 2016 coup attempt in Turkey saw at least 30 Germans thrown in jail.
Berlin hoped to secure the release of several German prisoners, who still remain behind bars.
However, Ms Merkel said “deep divisions” still remain between the two states despite reconciliatory efforts.
During his three-day visit, where he faced protests from thousands of Kurdish demonstrators, Mr Erdogan called for an end to racism in Germany, complaining about how football star
Mesut Ozil quit Germany’s national team after the World Cup claiming he faced racism due to his Turkish background.
The president added: “This racism has to end.”
On Saturday, Mr Erdogan concluded his trip by opening one of Europe’s largest mosques in Cologne.
At least 25,000 Erdogan supporters lined outside the mosque to show support for the president, chanting and waving Turkish flags as they stood behind barriers.
But about 1,000 anti-Erdogan protestors – including German left-wing activists – took part in a counter protest against Erdogan’s human rights record, restrictions on its press and the treatment of minority Kurds.
Police snipers were stationed on roof tops and the area was cordoned off to facilitate the mosque’s opening.
At the inauguration, Mr Erdogan said: “In a critical period, we have made a fruitful, successful visit to Germany.
“I stressed that we need to put aside our differences and focus on our common interests.”
One supporter, Ali Tas, commended Mr Erdogan’s visit and said: “It’s a great honour for us.”
Opposition protesters gathered on the opposite bank of the River Rhine, and were prohibited from marching through the city centre to avoid clashes.
Several allies of Mrs Merkel also hit out at Mr Erdogan’s visit, refusing to provide aid to Turkey’s dwindling economy, after its lira slumped to a record low in August.
They insisted Turkey’s state visit was “too early” for ties to be effectively amended with the German state.
Norbert Roettgen, chairman of parliament’s foreign affairs committee, told the Funke newspaper group: “The timing of this visit was wrong – it was far too early.
“The Turkish-German relationship is neither better nor simpler after this visit.”