Ender 3 v2 goes crazy on larger g code files

The problem is larger g code files keep breaking my ender 3 v2. Whenever i try to print with long prints the printer goes crazy. To fix that i need to go the factory defaults. I have shown in the video. Why it does this and how to preven this to happen. Can you help me.