Generally hackers who compromise a server get the complete profile of each user, including ID, password, and lots of personal information. The password for any competently managed site is salted and hashed with a strong hash (at least SHA-256, preferably SHA-512). (A “salt” is a semi random string that is appended to the password before hashing.) The hash function generates a seemingly random string of characters, and is not reversible, so just because you have the hashed value of the passcode does not mean that you can easily determine the passcode itself. But many sites skip the salt. For these all you need to do is use a dictionary search and try every combination against the hash function (which you also got from the break-in) until you find a hashed password that matches. I say “you”, but there are plenty of apps that will do this for you while you sleep, or you could just write one; a few lines of C code. Even some salted hashes can be broken, if the salt is simple enough (like the user ID).
This becomes impractical if the password is long enough (20 characters, for example) and allows (and the user chooses) a large number of characters including punctuation. But most sites don’t support long passwords, and many exclude even basic punctuation characters. Apple’s keychain will generate very secure random passwords, but must sites where I have tried to use one of these reject it for either disallowed characters of length.
But the bottom line is that the user ID for every password that has been compromised is known, but not all passwords can be compromised.
We are not even talking about sites that save the password in plaintext and don’t hash it. If your site can tell you the password that you forgot that’s a site you don’t want to ever use. Properly secured sites have a way to create a new password, but cannot tell you what your password is.