Filament buildup

Hello - I hope someone can help me with this. My apologies in advance as I am not very technically minded.

My last print failed and when I looked at the extruder, the box (for lack of a better term) where you screw in a nozzle was filled with melted filament. Apparently some of the filament made it to the build plate while some of it was also making a really big mess around the nozzle.

I noticed that the “box” is also a little loose - I assume that may be at least part of the cause.

Does anyone know what could be the cause of this, and what the remedy would be?

Clean up the mess and thighten the “box”…