Are you by any chance using a CY3214 board? If so, what revision is it?
This board has a capacitor on the P0.5 pin that is used for CapSense. If you output an analog signal on P0.5, your output will not be as expected because the analog output buffers in the PSoC device cannot drive very large capacitances. The capacitor on the board is around 10 nF and the analog output buffer can drive around 200 pF, max. So, this is why you are seeing a signal on P0.5 that is so unexpected.
I would either try the output on P0.3 or try removing capacitor C7 from your board.