GPT LLM algorithms use a probabilistic language model to generate text. It is trained on a large corpus of text data, and it estimates the probability distribution of the next word given the previous words in the sequence.
The algorithm tokenizes the input into a sequence of tokens and then generates the next token(s) in the sequence based on the probabilities learned during training. These probabilities are based on the frequency and context of words in the training corpus. You can ask ChatGPT/etc yourself, and it'll tell you something like this.
This is not remotely like what human brains do. Your ideas cohere from network connections between the neurons in your brain, and then you come up with words to match your idea, not your previous words or the frequency that the words appear in your brain.