Zero crossing circuit
You have ground connections on both sides of the opto-isolator and this is significantly problematic for isolation reasons AND will cause half wave rectification of the signal and lead to your output waveform being how you describe it. Just do this instead: -

Note also that controlling of an AC fan by using a triac may not result in any speed reduction and could lead to problems with the fan - it depends on the motor used inside the fan - standard AC motors are intended to be used for fixed speed applications. The devil is in the detail.