The answer is friction. When a current, say I amperes passes through a resistor of R ohms, power equal to I x R is generated and this power has to be lost as heat. Another way to think about this is the friction that would be generated when electrons pass through a material. The atoms in the material are in constant motion (since they are not at absolute zero temperature). When current flows through a material, the electrons come in contact with the atoms of the material and their collision produces heat. This heat increases the temperature of the material causing faster motion of atoms which will, in turn, more heat with ongoing collisions. When the flow is through a resistor, resistance is offered to the flow and the collisions will generate heat. This is the reason why temperature rises.
Hope this helps.