A* is a popular algorithm used in pathfinding and graph traversal. It will search for shortest path between two nodes in a graph. A heuristic is specified to guide the search towards it's goal. This is what makes A* more efficient over other search algorithms such as Dijkstra which explores all possible paths. The effectiveness of A* largely depends on the quality of the heuristic function that has been used.
In this case we use distance towards the end goal.