What a hash function is
A hash function turns any amount of input data, a single word or an entire file, into a fixed-size sequence called a hash or digest. The same input always produces exactly the same hash, a small change in the input produces a completely different hash, and the original data cannot be reconstructed from the hash.
Difference between the algorithms
MD5 produces a 128-bit hash, 32 hexadecimal characters, and is the fastest but also the least secure. SHA-1 produces 160 bits and is also considered unsafe for cryptographic purposes. SHA-256 produces 256 bits and is today the most widely used standard for integrity checks and digital signatures. SHA-384 and SHA-512 produce even larger hashes, 384 and 512 bits, used when an extra level of security is needed.
Hash is not encryption
Unlike encryption, a hash function cannot be reversed: there is no "password" or "key" that turns the hash back into the original text. Because of this, hashes are used to check integrity, confirming a file wasn't altered, and to store passwords securely, comparing the hash of the typed password with the saved hash, without ever storing the password as plain text.
MD5 and SHA-1 are not safe for passwords
Even though they still appear in many legacy systems, MD5 and SHA-1 are considered cryptographically broken: researchers have already demonstrated how to generate two different inputs with the same hash, a collision, which undermines their use in security contexts. For file integrity checks, they are still acceptable. But for storing passwords, the recommendation is to use algorithms designed specifically for that, like bcrypt, scrypt or Argon2, which are intentionally slow to make brute-force attacks harder.
Checking the integrity of a downloaded file
A common use of hashing is checking that a file downloaded from the internet wasn't corrupted during transfer or tampered with by a third party. Trustworthy sites often publish the SHA-256 hash of their installer files. After computing the hash of the downloaded file and comparing it with the published value using the third calculator on this page, a match confirms the file is intact.