A fever is when your body increases its internal thermostat, found in the hypothalamus. If you exercise hard or it’s a hot day, your body temperature might increase, but the thermostat remains at around 36.8°C. When you feel hot the hypothalamus tries to correct this with sweating and increased blood flow to the skin.
With a fever, it is actually the thermostat that has adjusted. This means your body temperature is now below 36.8°C, so you feel cold and shiver, to try and raise your temperature. The higher body temperature may help fight infection by speeding white blood cell production and slowing bacteria reproduction.