there was a German word with the definition that means: It only works when I try to show you how it does not work.

What you are probably looking for is called the Vorführeffekt.

It's used like

Die öffentliche Präsentation der Anwendung scheiterte leider am Vorführeffekt.1

It basically means that you try to give some evidence in public while showing how something works (or doesn't work), but you fail because it just gives evidence to present the opposite.