Ask the developers of "Evgeny Gustman". Only they are unlikely to answer. It is both difficult and secret. It is useless to ask here. And "Gustman" himself is hardly aware of how he works. "Shkolota" all the same.
I would recommend you to read this article, it directly tells about how AI can be "intelligent", as well as in simple language a little about the principles of its work in general
There are several approaches to creating so-called artificial intelligence, but one of the most popular methods is to teach the system by example. It is like preparing ourselves for solving some typical or similar problems.
A good, classic example: digital text recognition. A program is being written that, according to some principles, distinguishes some characters from others. Then, the program is "fed" with some "good" variants of images of letters, and then sentences. There can be many such stages of training, and at each the developer indicates to the program where it was wrong and where it was right. Thus, the program is adjusted to the examples. More examples - better results. Then, the program switches to recognition mode (not learning), where it can already recognize images and produce results. This idea was created in the early 60s by Frank Rosenblatt. Such models were called by him perceptrons.
Here the question may arise, how does the adjustment take place? The work of the entire system is often organized on the basis of a neural network, which, as it seems to scientists, simulates the work of our brain. A neural network has neurons (in a pure mathematical model, functions that take several variables and can also return a certain set of results) and connections between them. Each neuron has its own function, its own parameters, and connections have a weight. Tuning consists in changing parameters and weights.
Another interesting approach to AI design is genetic algorithms, which are based on biological processes: crossing, mutation and "survival" of the best genes (models), but this is another and also very huge topic;)