How do AI chatbots work?

They combine NLP and machine learning to interpret messages and generate relevant responses.