Those are website notifications. The reason for their appearance is that agreed to have one or more websites send them.
Stop them by following these instructions:
- Go to Safari's Settings (or Preferences) menu > Websites > Notifications, and remove everything there.
For reference: Change Websites settings in Safari on Mac - Apple Support
Don't allow websites to send you Notifications unless you are 100% certain you want them. I cannot think of a single reason anyone would want to invite that kind of harassment.
Refer to Customize website notifications in Safari on Mac - Apple Support. Deselecting "Allow websites to ask for permission to send notifications" will prevent those websites from even asking your permission to be harassed by them.