They collide with the ions in the wire, causing the ions to vibrate more. The increased vibration of the ions increases the temperature of the wire. Energy has been transferred from the chemical energy store of the battery into the internal energy store of the wire.