This is a tv-series made in the 70's in West Germany.
The plot is a man that senses that everything is not as it seems, he feels like everything is a computer simulation. There are people after him trying to prevent him from discovering the truth. A woman is helping him.
Spoiler tags might not be needed but the ending is:
It turns out he is right. His mind has been projected into a simulation while he is beeing cured of a disease. They try to prevent him of discovering the truth to prevent his mind from harming itself.