It's a consequence of the inflammation response. The fever itself is due to prostaglandins action on the hypothalamus. The vasodilation, such as when someone experiences systemic shock is due to interleukins released by immune cells and also histamine (mast cells), which act to loosen the blood capillaries, so additional immune cells can come to the area of infection. This is a good way of dealing with localized infections, but problems arise when an infection travels throughout the body (such as when a bacteria escapes its immune containment). At that point, the individual undergoes systemic shock (huge loss of flood) and a huge drop in blood pressure, eventually causing death unless treated appropriately. The fever itself helps to raise metabolic activity so that the environment is less ideal for bacteria to grow (because bacteria grow in optimum temperature environments).
Also, vasodilation in general does not cool the body. Vasodilation at the skin surface helps to let latent heat escape from the skin, which as a consequence cools the body.