Least Energy Path, Contour Following, around Hills toward Goal
If $\gamma : \Bbb R \to \Bbb R^2$ is a level curve of $h$, then then $h \circ \gamma$ is constant, and therefore its derivative is $0$: $$\frac {d(h\circ\gamma(t))}{dt} = \nabla h\cdot \dot \gamma(t) = 0$$
That is, the level curves always move perpendicular to the gradient. One such vector perpendicular to $\nabla h$ is $(h_y, -h_x)$. If we look at the flows of $(h_y, -h_x)$, then we have a set of level curves through every point. All other level curves are just reparameterizations $\gamma(g(t))$ for some $g : \Bbb R \to \Bbb R$.
In the discrete case, you estimate $h_x$ with $\Delta_x h = \dfrac{h(x + \Delta x,y) - h(x,y)}{\Delta x}$, and similarly for $\Delta_y h$. The horizontal direction is thus given by $h^\perp = (\Delta_y h, -\Delta_x h)$. But to control step size, it is helpful to normalize this (we only need a direction perpendicular to the gradient of $h$, not a particular vector). So, we define $$\hat h^\perp = \left(\frac{\Delta_y h}{\sqrt{\Delta_y h^2 + \Delta_x h^2}},\frac{-\Delta_x h}{\sqrt{\Delta_y h^2 + \Delta_x h^2}}\right)$$
Moving in this direction should be level. So if you start at $(x_0, y_0)$, and are moving with stepsize $s$, the next level point should be $$(x_0, y_0) + s\,\hat h^\perp$$