So i wanted to make a quick small test on comparing hashes between a word document and a small modification inside the document and then revert the changes back to original and check all the 3 hashes. Of course the original and the modified document hash will be different but why is it that when i changed the document back to how it was originally ended up having a different hash when they have the same context?
As others have pointed out in the comments, a Word document is more than just the visible text you see. Various bits of metadata (such as last modified time, or 'track changes' history) are stored within the file. If even one bit of one byte were changed, the hash would be completely different.
If you wish to find out which bits have changes, you can compare the original against the modified-then-changed-back copy with a tool like the unix "cmp" (compare files) command, which will tell you the byte location of the furst difference.
Or, break out your favorite hex editor to examine the bytes in each file, and you will find your non-visible change.
Also, as others pointed out, your case is particular to Word (and other meta-data-storing file formats). If you tried this experiment with a flat ascii text file, you would see the changed-back file have the same hash as the original.
As others have posted, Office/Adobe documents contain meta-data (as well as other document formats). You can attempt to scrub these but YMMV.
Your hash changed because the meta-information (e.g. date last modified) changed.
Word actually has a built-in feature that will generate a hash (and a digital signature) for you. It's called Insert Signature Line. While the primary purpose of this feature is to allow you to provide your signature, it also binds that signature to a digital hash of the contents so that you can prove if someone modified the document after you signed it.
You could also scrub out the meta-information in the Word doc by saving it in a plain format (e.g. UTF-8 text-only format). See this answer for someone else's answer on how to do this.