This case is a bit more complicated. As far as I recall, it started with extra3 (a satire show on NDR) airing a critical song about Erdogan. The song can be found on Youtube: https://www.youtube.com/watch?v=R2e2yHjc_mc (Closed Captions are available in English, but you need to turn them on)
Erdogan obviously didn't like being criticised, so he complained that NDR was committing an “insult of organs and representatives of foreign countries” under § 103 StGB and a regular insult under § 185 StGB.
This attempt to silence NDR obviously didn't get far because the song published by NDR was covered by freedom of press and/or the freedom to express ones opinion.
To illustrate the difference between an expression of opinion and an insult, Jan Böhmermann then wrote a Schmähgedicht (smear poem) containing both criticism and profanity which he presented in his late-night show “Neo Magazin Royale” on ZDF.
It looks like the video was deleted from Youtube, but other sites still have it: https://vimeo.com/162455052
Unfortunately, the video doesn't have closed captions, but you can find a translation of the poem here: https://lyricstranslate.com/en/schm%C3%A4hkritik-vituperative-criticism.html (I suggest that you take a look at the translation as it helps understanding why part of the poem got banned)
Erdogan tried to fight this poem under civil and penal law and at one point, he even managed to obtain a preliminary injunction from the LG Hamburg where part of the poem was banned. To make things clear for the general public, the court even published a press release which explained which parts of the poem were banned and which parts weren't banned. The press release can be found here: https://web.archive.org/web/20160518111309/http://justiz.hamburg.de/oberlandesgericht/6103290/pressemeldung-2016-05-17-olg-01/
And the attachment to the press release is here: http://justiz.hamburg.de/contentblob/6103298/6b1b7ae264e23809630af9d7716ef2fd/data/schmaehgedicht-jan-boehmermann-pdfanhang.pdf
Böhmermann's smear poem later lead to the removal of § 103 StGB from the penal code and to the addition of the word “smear poem” to the Duden.
For further reading, I recommend the following Wikipedia articles:
(THe German versions are more extensive, especially with regards to the court proceedings.)
https://en.wikipedia.org/wiki/Extra_3#Erdo%C4%9Fan_controversy
https://de.wikipedia.org/wiki/Erdowie,_Erdowo,_Erdogan
https://en.wikipedia.org/wiki/B%C3%B6hmermann_affair
https://de.wikipedia.org/wiki/Böhmermann-Affäre