How does a fuse work?

In short, a fuse is nothing more than a controlled failure.

If too high current flows into a circuit, a too large power is generated, $$P=I^2R$$Components and wires all have a limit of how much energy they can absorb before melting or burning. If you let it go wild, you will not know which component or wire that will fail first. Maybe an expensive one, a hard-to-replace one, or maybe one that risks causing a fire.

So, to avoid any such random failure that could be catastrophic because we have no clue of where or how severe it would be, then we instead add one component with a lower durability than all other components, parts and wires. And then we make that weakest component of a material that melts rather than burns with flames and we incapsulate it to keep it controlled when it fails. Maybe we even place it on an accessible place so we can easily replace it when failure does happen.

That weakest component is the fuse. It is simply a component chosen to be sacrificed, so that all others will survive.