Large language models repeatedly chased losses, escalated risk and even bankrupted themselves in simulated gambling environments, a study found.