In the wild, they eat just about anything they can find: algae, fungus, or dead stuff they find lying around.
But as a pet you can feed them special "crab food" that sinks to the bottom. (They like to sift through to find it.) You can also give them freeze-dried plankton and shrimp.
They eat algea, tropical fish flakes , whitebait, anything decaying...dead fish will do.