Good question! Work can be negative or positive and it’s important to know when so that your energy balance will be correct. When your system does work (the gas inside it expands) your system does work to move the boundary, thus your system uses its energy to do work -> causing internal energy to decrease thus work is negative. On the other hand, when work is done on the system something external does work and increases your systems internal energy, like compression. Thus the work is positive. Hope this helped!🧊