It doesn't. However, you can "kill" a magnet by heating it up. Also by bashing it really hard. However, that is not heat destroying magnetism, so much as heat disturbing the delicate and precise arrangement of aligned "mini-magnets" inside the magnet. If the mini-magnets are no longer aligned then the magnet loses its magnetism, and crucially, there aren't any dynamic forces that would drive the magnet to restore the alignment.
The Sun, however, very much is a dynamic. So even if heat were to screw things up (which itself is doubtful because it's a very different system from a cold metal bar), then the dynamic forces inside the Sun would drive the recreation of its magnetic field.
Magnetism is, probably, the poorest understood of the basic forces at least from a layman's point of view, as it's usually introduced in terms of those magnetic bar magnets and horseshoe magnets, etc, making it look like a very "static" force. In reality, magnetism is all about motion.