Why is XHHW more costly than other similar cable?
Different insulators, different properties

The THHN/THWN-2 we know and love is a thermoplastic insulation (most commonly a plasticized and flame-retarded PVC) with a thin nylon outer jacket extruded over the PVC that helps protect the PVC from damage.  This means that:


while it's flame-retarded, it produces ugly things (HCl) once you get it going in your bonfire
It can have annoying behaviors when pinched for a while (like cold flowing)
It is prone to certain breakdown behaviors that can be undesirable especially at higher voltages


XHHW and XHHW-2 wire, on the other hand, use a thermoset insulation, almost always a cross-linked polyethylene very similar to what PEX pipe is made from.  The cross-linking makes the wire insulation stiffer and harder to handle and requires more specialized processing which is probably the explanation for the price difference you're seeing. However, XLPE insulation is more thermally robust than PVC and is also a better electrical insulator as well -- it can handle higher voltages, is less breakdown-prone, and won't flow under pressure nearly as easily.

Usage differences

XHHW(-2) is generally a better choice for applications in unkind environments (exposed outside, on roofs, or directly buried) due to its improved ruggedness.  THHN is cheap, and is considered to work well enough for benign environs such as the insides of jacketed or armored cables and inside conduit, so it's generally what's used when XHHW(-2)'s superior properties aren't called for.