I had encountered this problem once before, in my case I wasn't using the points in the navigation array properly,
Assuming you've a similar setup where you create a list/array of points from the enemy node to you player node called path
what you need to do in your Enemy.gd script at line 31:
instead of equating the position of your character and first position in the path (path[0]):
if global_position == path[0]:
change it to something like this:
if global_position.distance_to(path[0]) < 1:
This checks if the distance between the Enemy node and the path[0] point is less than 1
From my intuition this weird thing happens would be because somehow the engine misses the point where global_position == path[0]
and doesn't remove the path[0] so your character just keeps chasing the path[0] which hasn't been removed yet and gets stuck there.
Here's a repo where I built my firest Godot game using these techniques you can have a look at it if you'd like:
https://github.com/1MochaChan1/scares