What your saying is not wrong, but as you can see from all the differing comments, it's not unambiguous, given the multiple meanings of 'fix', 'peg' and 'pin'. Whilst assumptions can be made from context, your particular scenario doesn't really lend itself to clear assumptions. To be unambiguous, I think you should say, I fastened the towel with a clothespeg/clothespin. Collectively, items such as buckles, buttons, pins, etc.. are known as fasteners, so fasten would be the best verb to use.
The only thing I would say might be wrong with using the verb 'fix', is that it suggests a degree of permanence. To me, that is the difference between fixings and fasteners. You can unfasten, but you can't unfix. Fixed means unmovable. I assume at some point you would want to remove the towel, and you wouldn't ever say, I unfixed the towel.
Without the image you provided, I would have imaging you holding a towel in pace with something similar to a tent peg. A clothes peg isn't really a peg or a pin. Pegs and pins using piercing to hold things in place. A clothes peg is really a clamp. But if a jellyfish is not really a fish, it doesn't really matter.