How to reduce the background canvas size to the layer size.
Image > Fit canvas to layers but it does not do this.
In Fireworks there was a button named
Fit To Canvas for doing this. I searching this in Gimp.
In GIMP, Fit Canvas to layers resizes the canvas by taking into account the largest layer and all the other layers. So the reason it has failed means that you must have a layer that's bigger than the layer/layers you were expecting it to be resized to. At a guess, and without seeing your file or arrangement of layers, I'd say that's probably your background layer.
To fix it, remove the layer that's filling the canvas, then repeat the Fit Canvas to layers.
Alternatively, if you don't want to remove any layers, select the layer you wish to use for resizing the canvas, and in the layers panel right click it and choose Aplha to Selection, then click Image > Crop to Selection.
Note that cropping in GIMP is destructive, and it will crop the background layer if there is one, so you may wish to save your XCF file, and work on a copy before doing any of these operations.