Jelly can go awry every now and then (4)
I believe the answer is:
agar
'jelly' is the definition.
(gelatinous substance)
I cannot understand how the rest of the clue works.
Can you help me to learn more?
(Other definitions for agar that I've seen before include "Jelly got from seaweeds, used in foods" , "Jelly medium" , "Substance derived from seaweed" , "Seaweed jelly" , "Jelly used in bacteria culture" .)