Here's a simple example:
A hash of the string "Hello world!" is "Hel". If you're given "Hel", you cannot recreate "Hello world!", and yet it is likely not going to clash with many other strings.
Admittedly, this hash isn't very good because if this were a password, knowing the first three letters makes it a lot easier to brute force the original password.
So what if we multiplied each letter value by 3 mod 26?
H (7) * 3 -> V (21)
e (4) * 3 -> m (12)
l (11) * 3 -> f (5)
Now our hash is "Vmf". Granted, you could reverse this, but without knowing that it was multiplied by 3, this already becomes a bit tricker. For a computer this is trivial, but imagine multiplying against enormous prime numbers. It would make finding a pattern virtually impossible, and you'd have to dedicate long computation hours calculating possible values and trying them out.
Converting it to "Vmf" was a trivial matter, but restoring to "Hel" isn't. This is exactly what we want from a hash.
If the user provides the string "Hello, World!", without having to save the original string, we can simply apply the hash to "Hello, World!" and obtain "Vmf" and then compare that string to the one we have on file..
"Vmf" === "Vmf" // Bingo!
And in a nutshell this is what hashing is. There are various techniques, but the concept is ultimately the same. Deterministically create an irreversible string of data from an input.