This is a matter of the frame of reference. Work done to a system increases the internal energy of that system, so you can say E = Q + W. Work done by the system decreases the systems internal energy so you can say E = Q - W.
Many times Chemistry looks at things through the perspective of you being the internal system in which you consider things that are happening to you. While many times Physics considers things that a system does. So the equation MUST be applied to the frame of reference you set up. The frame of reference is crucial in either science.