Md5 is a one-way hash, that means when you have a string like
"The fox jumped over the dog"
you can md5 it, which will result in
a8e294e6e7f6eecece9e7103f646daae.
This will be put in the database, and it cannot be reversed.
When someone enters his password, it will be hashed, and if its the same hash as in the database, he can login.
MD5 cannot be reversed, so when someone hacks into your database, he can't get the passwords out.