Unused resources are not deleted automatically when you delete the note, but Joplin checks in the background for ununsed resources at regular timed intervals.
I have the same problem and opened a gh issue. This is definitely a bug (you only have to check the exported table):
These resources are more than a month old, yet they are still there, even though they are not associated with anything. I guess @laurent hasn’t had a time to go through all the github issues. Thus I suggest patience. I’m in the same boat.