The story is that Doctor Faust surrendered his soul in exchange for infinte knowledge and magical powers. A deal with the devil.

It’s a deal made with someone you know is evil or amoral, and the deal is usually tragic because what you lose is in the end more valuable than what you get.