At the core, a large language model is trained to do one job: given some text, predict what word is most likely to come next. It learns this by reading enormous amounts of text — books, articles, code, conversations — and adjusting itself billions of times until its predictions line up with real language.
That sounds almost too simple to explain fluent conversation or working code, but predicting "next word" well requires the model to implicitly absorb grammar, facts, reasoning patterns, and style. Ask it to explain a topic, and it's essentially completing a very well-informed paragraph about that topic based on everything similar it has seen.
This also explains their weaknesses. Because the model is predicting plausible text rather than looking up verified facts, it can produce confident-sounding statements that are wrong — a failure mode often called hallucination. Understanding that models predict rather than retrieve is the single most useful mental model for using them well.