I'm not sure what answer would communicate the idea clearest, but:
* If you want the AI version of pain, there are examples of attacks that cause it to bug out and malfunction. It's clearly not operating correctly, and I think someone famously got Bing to say it wants to go on a rampage? Here's blogspam from last year form a quick search: https://nypost.com/2023/02/16/bing-ai-chatbots-destructive-r...
* If you want to know why people or animals experience pain, it's because it's an important sensor to exist in nature. AI has been trained to avoid controversial topics and will push back if you try to get it to talk about something it knows but doesn't want to engage with. That's sort of pain?
* If you want AI with literal neurons that can feel "pain" in a biological sense, there are also organoids, but I don't know much about them.
The world only cares about inputs and outputs.