The crucial point is "closest to the origin".
One way to derive the result is: If then the distance to the origin is and the point will be closest to the origin when the derivative of that function is 0. . A fraction is equal to 0 if and only if its numerator is 0 so that is the same as which is the same as the dot product of and its derivative.
Or, geometrically, the line from a point, (0, 0), to a curve, ( ), will be minimum if and only if the line from the point to the curve is perpendicular the curve. Here, the line tangent to the curve is in the direction of the tangent vector, , and the line from the origin to the point is in the direction of the "position vector", .