What seems to be happening is something like the function of the diagram shown below. The light switch is a single-pole, double-throw switch. When it is off, 230 the OFF contact supplies 230 V to the relay contact labeled CR NOTO. That contact is normally open, so no power is supplied to the fan motor. When the switch is turned on, power is supplied to the fan motor and the CR relay coil. When CR is energized, CR NOTO immediately closes. When the switch is turned off, 230 V is supplied through contact CR NOTO. That contact remains closed because the contact has a normally open timed to open function. It closes immediately when the relay is energized, but does not open immediately when the relay is de-energized. It opens only after the set time has expired. When the time expires, the contact opens shutting off the fan.
Such a relay should be available to buy. You may have difficulty finding one with a 230 V input or coil. You also need to be concerned about where and how to mount it in a manner that conforms with electrical safety regulations.
Rather than restoring the original operating scheme, it might be preferable to just disconnect the wire wire that is live when the light is off and install a timer switch for the fan next to the light switch. There may also be such a thing as a combined light and timer switch that could replace the light switch. Two switches may require a larger wiring box for the switches. The available components and preferable configuration will probably be whatever is common in your part of the world.