The definition of a function requires that every $x$ value has at most one $y$ value. It doesn't require that every $y$ value has at most one $x$ value though, so the inverse of a function is not necessarily a function itself.
The vertical line test is to check if a curve is a function. If at some point the function crosses a vertical line twice, it's telling you that there are two $y$ values for that $x$ value, so the curve is not a function.
When you find the inverse of a function, you reflect the function by the line $y=x$, or swap the $x$ and $y$ axes. So if you want to check whether a function has an inverse that is also a function, you can check whether every $y$ value has at most one $x$ value, so you use the horizontal line test. If a horizontal line cuts the curve more than once at some point, then the curve doesn't have an inverse function.
So in short, if you have a curve, the vertical line test checks if that curve is a function, and the horizontal line test checks whether the inverse of that curve is a function.