The LLM doesn't have a goal. But ChatGPT is not just an LLM - it's an LLM + a loop + a prompt that sets the context. And it's that prompt that tells the entire combination that "it is a helpful assistant" etc, thereby giving the whole combination a goal, which it then observably follows.