Artificial Intelligence is in some way trying to replicate the human brain using computers. The brain isn’t wired quite the same as a computer and vice versa. So it can’t work in exactly the same way but instead it has a good stab at trying to replicate it.
To achieve this programmers (coders) have created Artificial Neural Networks (ANN) based around the brain’s neural network. The brain fires neaurons which carry small electrical charge, this can be replicated. It is the learning process which is different and is what makes AI be AI.
This is done through something called back propagation. The problem is that to d a simple task like recognise a number requires quite complex coding and is not for the faint hearted but it is not impossible or stupidly difficult. Designing your own to fulfil a particular task is somewhat of a challenge though.
The bottom line is, the brain is still infinitely superior to any computer when asked to do a range of tasks. But where the computer scores over the brain is the speed it can process things like the square root of 246. For us it would take more than a few seconds.