We "check" with someone before coming and going in various circumstances. You mention a hospital; other examples include a hotel, a grocery store, a secure apartment complex. The expression comes from your identity, credentials, or authorization being examined ("checked") on your way in or out.
The expression has been variously extended to encompass other meanings nowadays: "I tried to get Joe to help, but he seems checked out these days" meaning that Joe is disengaged.
Your original question, before and after editing, exhibits yet another example of how subtle English can be; these two sentences mean very different things:
I checked out that hotel; it was awful!
I checked out of that hotel; it was awful!
The first implies you merely examined the hotel; the second implies you were staying there and decided to leave.