The largest interval for x ≥ 0 where cos(x) passes the horizontal line test is [0, π]. Hence the domain must be restricted to that interval if the function is to have an inverse that gives values in the range [0, π].
The domain of the function is the same as the range of the inverse function. Restricting the cos(x) function domain to x ∈ [0, π] restricts the range (functional values) of the inverse function to the same interval.