From my initial studies, AI is not like any program. In fact, I have read the developers do not know how it actually works.
In simple terms it is predicting the next most likely word based on the data it has been trained on.
Kind of like posting here sometimes. I’ll type and it puts something in I wasn’t intending.