Hair (like nails, horn, hoof, fur and the outer layers of skin) is made from a protein called keratin. This has long coiled molecules, locked in their shape with strong cross-bonds (sulphur groups if I remember right).
"Perms" (and presumably also straighteners) temporarily knock off the locking bonds, making the keratin softer and the hair floppy. Once placed in the new shape, another chemical locks the protein coils together again, so the new shape of each hair holds.
I think the awful smell is to do with the chemicals containing sulphur.