The term refers to the pact that Ulysses (Greek name Ὀδυσσεύς, Odysseus) made with his men as they approached the Sirens.
Ulysses wanted to hear the Sirens' song although he knew that doing so would render him incapable of rational thought.
Psychiatric advance directives are sometimes referred to as Ulysses pacts or Ulysses contracts, where there is a legal agreement designed to override a present request from a legally incompetent patient in favor of a past request made by that previously competent patient.
[1] An example of when Ulysses contracts are invoked is when people with schizophrenia stop taking their medication at perceived remission times.
One example is that Apple, as part of the FBI–Apple encryption dispute, decided to engineer the iPhone in a way that made it impossible for them to read the data on it, which has been described as "a digital Ulysses pact".