An LLM learns the patterns of language by reading enormous quantities of text — books, articles and websites. From this it learns which words tend to follow which, allowing it to answer questions, write, summarise and translate.
Under the hood, an LLM predicts the next token (a word or word-piece) over and over to build a response. It has no true understanding or beliefs; it is an extremely sophisticated pattern-matcher.
For example, when you ask an LLM to draft an email, it generates each word based on everything before it and the patterns it learned in training. This power comes with limits, including a tendency to hallucinate confident but wrong answers.