Multiply analog and square signals
There are several things going on here:

The trace looks like you have that scope channel set to AC coupling.

There is nothing pulling Vout up when V1 is high.

It's hard to get into more detail without knowing the voltage ranges of V1 and V2, but Vout will follow V1 plus the B-E drop when V1 goes low.  So if V1 goes negative by more than 700 mV or so, Vout is expected to go low.

Overall you probably want to replace D1 with a resistor and have a transistor clamp Vout to ground or not.  This means replace Q1 with a NPN and add a base resistor.