Defining Internal Energy The first law of Thermodynamics is $$ dU = dQ - dW $$ Halliday and Resnick says that energy transfer of heat Q $\text{occurs to the system}$ (which is by convention positive) and a Work W is done $\text{by the system}$ (which is by convention again is positive). this total energy transfer is the internal energy so shouldn't internal energy U be defined Q + W rather than Q - W.
Please let me know why is it defined Q - W whereas in chemistry it is defined as Q + W?
The above conventions are mentioned in Halliday Resnick
 A: The convention for the International Union of Pure and Applied Chemistry (IUPAC) is the Kelvin form
$dU = \delta q + \delta w$
Heat eXits the system in an eXothermic process (and eNters in an eNdothermic process). Work eXits the system when it is done by the system. In either case (heat or work), exiting values are negative.
The convention for engineering is the Clausius form (which was the first statement of the first law)
$dU = \delta q - \delta w$
The same conventions apply for heat (negative for exothermic processes, positive for endothermic processes). For engineers, work done by the system has utility for us and is given a positive sign.
Both forms are explained here
A: 
Please let me know why is it defined Q - W whereas in chemistry it is
defined as Q + W?

It's simply a matter of convention.
The sign of $Q$ is the same for both, with the sign for $W$ reversed. In the version $\Delta U=Q-W$ work done by the system is considered positive whereas in $\Delta U=Q+W$ the work done by the system is negative. But since, in the absence of heat, when a system does work its internal energy decreases, both versions are consistent.
Hope this helps.
A: Halliday and Resnick is not, in my opinion, a good book. There are many editions, and most of them have egregious errors that are corrected in the next edition, while  new errors are added.
I don't know what they say here, but work done by the system can be  positive or  negative. When work done by the system is positive the system  looses energy. Similarly the heat added to the system can be both positive or negative. When it is postive the system gains energy.
Note that Chemists and Physicics have opposite sign conventions. For physicists $Q$ is postive when the system gains energy, and for chemists $Q$ is postive when the system looses energy to the outside world (an exothermic reaction for example).
