A very subtle difference !
With companding, the system gain is controlled by an externally applied control voltage, which usually goes into some kind of analog multiplier.
Where that control voltage comes from, and how it is derived determines if the incoming amplitude dynamic range is expanded or compressed.
Companding is often used for audio applications.
Non linear systems are often typically logarithmic in response to amplitude.
The human ear is like that.
Some applications (like radar) you might want to compress a very wide dynamic range in incoming amplitude to something with much less dynamic range that can be more easily seen on a radar screen.
You don't want weak signals to be so faint that they are invisible, or super strong returns to be so bright they overload the display with maximum brightness.
Similar thing with a gas chromatograph, You want to reliably detect trace amounts of some compounds, but don't want to be driven way off scale by massive concentrations of other
things. So your vertical scale on your chart might be made logarithmic.
With companding, the gain slews up and down over time, perhaps controlled by some feedback signal, but the system remains linear with no amplitude distortion.
With a non linear system, the signal amplitude itself determines the gain. It is instantaneous and very convenient for many things, but it does introduce amplitude distortion into the signal.