1. It could be the space between your links. Your margin is .04m or 4CM about 3/4 of an inch. If the mesh is inside of the the margin when the simulation start it will do funky things like jump outside or go flying off. Since it’s solid links you might want to change the source to base instead of deform.(I have to do this to reduce CPU usage, but I’m on an old system…or I was. I haven’t done rigid body since I got my new computer a couple of weeks ago. You will probably need to make the loop/handle/link of the cube have more space for the chain link to fit into.
2. Local origin. Make sure that each links origin is in the center of the link. It seem logical to put it at the top of the link but that causes so many weird glitches. After discovering this I now just use right click->set origin->Origin to geometry.