In an electric car, instead of the AC and heating systems being powered by an engine, it is now powered by an electric motor.
Tesla states that their HVAC (heating, ventilation, and air conditioning) system is designed with a compressor similar to a kitchen refrigerator. The AC system at the front takes power from the Energy Storage System (ESS) located at the back of the vehicle and disperses chilled air through the vents.
Although this is a relatively simplified explanation of how the system works, it is effective. So effective in fact that auto engineers are considering implementing a similar electric system in traditional combustion vehicles to limit the amount of fuel spent on climate control systems.