How does this time-stamping system work?
But what if someone has a copy of (e.g. steals) the original file? How can I certify I was the original owner?


If you want to use the bitcoin blockchain as timestamped proof that you had the idea (document) first, then you’d need to be the first one to submit the document for a time stamp. A timestamp doesn’t prove ownership of an idea, just possession of it at that time. 


  If I go to a legal entity that can make a proof of the document with my identity and date, it doesn't matter that someone steals it from me, because the document is certified with my identity. Since the blockchain is anonymous, this does not work. Can anyone explain please?


You could simply add your name to the document that is being timestamped to prove that you were the one that submitted the document at that time. Since only a document hash is stored, this wouldn’t sacrifice your privacy at all. 

Alternatively, if you created the OP_RETURN transaction yourself, then you could sign a message using the private key of the bitcoin address that was used as input to the transaction. This would prove you have the private key that was used to sign the transaction that timestamped the data.