PIC pins change state when DC motor connected
My guess (there's not really enough information for more than a guess) is that the 5V supply rail is collapsing when the motor turns on (motor may be stalled, too powerful for your supply, etc.).  To troubleshoot this further, break the problem down:

First, disconnect the PIC and the motor and just focus on the driver chip.  Make sure ALL the inputs are defined (pulled high or low) - even the inputs you aren't using.  Make sure any outputs you aren't using are floating.  Now, with 5V on the Vcc of the driver, take the EN pin high, toggle an A input, and verify that the appropriate Y output goes high and low following the A input.  Do that for both A inputs.  If it doesn't work, record the voltages on ALL the pins (supply, input, output, even GND in case you miswired something) of the driver and report them here.

After that's working, connect the motor, toggle the A inputs again and verify that the Y outputs change as before and that the motor turns as expected.  If it doesn't, record the voltages on ALL the pins of the driver (particularly the Vcc pins) and report them here.

Next, connect the PIC, and repeat the above procedure with the PIC driving the pins.

If you go through it methodically, you will find the problem.