thanks to Tetsujin I found the Mac settings that related to it
This would be in Mac Settings -> Notifications, of course in my system which is in Danish is it Systemudstillinger -> meddelser but the same stuff.

above a screenshot of my danish system with the messages turned on. The text will of course change for another language.
However this is not the only thing that applies to the notification icon being on.
There is also settings in Slack, in Slack if you go to Preferences (which you get to by clicking your workspace), the notifications panel should be shown, you will probably have to scroll down to see the part that says:
Sound & appearance
Choose how notifications look, sound, and behave.
under that there will be a checkbox with the label "Show a badge A dock badge on Mac on Slack's icon to indicate new activity", you have to have that selected.