It means whatever the person doing the rating wants it to mean.
Usually it means that 40W of power may be dissipated, used, or supplied in association with the thing in some reliable fashion. i.e. a 40W light bulb will dissipate 40W of electricity as heat and light (at the rated voltage); a DC power supply rated at 40W will produce voltage and current combinations not exceeding 40W.
If you exceed the manufacturers rating, you can void guarantees.