Google returns matching websites, ChatGPT "understands" what you ask of it and can structure a response accordingly. Ofc this is a simplification. Google likely uses a lot of Natural Language Processing but it's a good demonstration with something trendy.