Because wearing black is associated with somber occasions.
It started when black and white were pretty much the only colors widely available for clothing … white was associated with weddings for women … and they didn't want to use the same color for funerals.
;)