Heat doesn’t cause a fibre to hold its shape. Heat destroys the shape of the fibre, allowing it to be reset into a new shape.
Each fibre of hair or cotton is composed of a great many molecular chains. Basically tiny fibres in their own rights. When the links are cold, they lock in place and can’t be moved without applying a lot of pressure. However when they are heated the links start slipping past one another a little, allowing the fibre to be moved into a new shape. Then when it cools again the links once again lock, but this time in the new shape.
You an think of it like a literal steel chain, where the links are so tightly set that the chain acts like a rigid rod. But when you heat the chain, the links swell and they can be bent and moved like a normal chain. While the links are swollen and loose like that you can place the chain into any shoe that you like: a spiral an L-shape, a flat line whatever. And once you remove the heat the links will shrink again and lock into place, leaving the chain fixed into the new shape until it is heated once again.
What that means is that heat isn’t causing the firbre to hol the shape. The cold fibre will hold it’s shape until something applies enough pressure to move it. What heat does is make the fibre flexible enough to bent into a new shape without very much pressure at all.
As for the effect of water, hair surely does absorb water. I don’t know whether the person who told you that was mistaken, or you have misunderstood, but hair is quote good at absorbing water.
The reason why wetting your hair or cotton destroys any shape you’ve given it is precisely *because *it absorbs water. The water then chemically bonds to the molecular chains, effectively partially dissolving them. Because the atoms within the chains are now bonded to the water, the links between them become weakened. That allows them to start slipping past one another again. In the case of hair, it has a natural shape that is a result of the precise chemicals it is made of. That is the lowest energy state for the hair. If the molecular chains are free to slip around they will eventually “fall” into that shape, and because it is a low energy shape you then need to put a lot of energy in to get them back out of it. That energy normally comes on the form of pressure, but if you aren’t applying pressure to the hair while it is wet it’s just gonna stay in the low energy natural shape, the way nature intended it.