Understanding a simple opto-isolator circuit
Both the optocoupler and the NPN invert the signal, so zero in is zero out, high in (with enough current) is high out.  When the optocoupler turns on (on a high input), it grounds the base of the NPN, stealing its drive current and turning it off, allowing 3V3 to be pulled high.