What you're asking is very basic programming, depending how deep you wanna dive in. Regarding your request, there are tons of tutorials out there, like the platformer one from BornCG or Rafa Fiedo which includes enemy ai.
You should start with that. Learning is not a race, it's a marathon, it takes time.... which brings to point number 2, always add details in your question. I don't know if you plan to do a sidescroller, top down or even 3D (NavigationMesh for pathfinding). Depending on that, the AI has to be programmed differently where top down or ¾ view is the easiest.(Navigation2D)