This is an answer as generic as the question.
For basic movement, you can set simple rules and make it move according those rules.
There are many techniques to detect and follow, that should be part of the mechanics of your game, you can do some basic things easy trying to reproduce your mechanics with code.
For a RPG proper, there is a lot of study and research on general AI, you will need to learn about finite state machines first, then steering behaviours and other stuff, depending always on the design complexity.
An advice, write the basic mechanics on paper (basic, leave extra features for later), draw everything, try to reproduce that with the engine.
Then you will have more clear where you lack of knowledge and what to ask on specific problems.
ps: godot lacks of resources for people starting from zero but there may be a couple of tutorials around for that.