This seems to be more a question for chemistry. The reason lays on the atomic bonds.
First at all, for high enough temperatures all solids will go to a liquid or and gaseous-like state and behave like marbles. And for temperatures near 0 Kelvin the marbles will behave more or less like a crystal.
... if we take different marblemarbles in a box and shake it then it should beshouldn't they arrange themselves in order to get to a low energy state.
It does. Nearly all marbles will lay in the closed-packing of equal spheres.
And why the balls do not stick together an the crystalline level? Because it is needed some activation energy. But that’s all about chemistry.