From ChatGPT itself:
ChatGPT is a computer program that can have conversations with people. It uses machine learning (ML) to generate text based on examples of text it was trained on. When someone asks it a question, it looks at the words used in the question and predicts the most likely next word or words to create a response. It uses a type of ML called deep learning, which helps it to understand and use language like a human.
ChatGPT generates a response by sampling from the predicted probabilities of the next word. The model continues generating words until a stopping criterion is met, such as a maximum length or a specific termination token.
Think of it as a Google search engine plus Quora plus Siri in one chat bot. More like your all-knowing personal assistant.