I plug a usb cord into my computer and it turns off?

I got an apple MacBook Pro a week ago today. And Last night it randomly shut off and wouldn't turn back on. So i took it in to Best Buy (where i got it) and they just gave me a new one ant transferred my stuff on to it. Now with this new one (That I got less than 12 hours ago) i plugged in my iPhone usb cord to the usb port farthest from the screen and it instantly shut off. I was able to turn it back on and tried again with the same port and it, again, turned off. So I turned it back on then tried the other port and it (thankfully) stayed on. Why do you think it turned off when i plugged it in to the first port?

Sounds like something is shorting. I would maybe get a new cord and avoid the problem port for sure. Could wind up burning something out in the notebook.

Some USB chips can't provide the full specification Current.
your phone may well be trying to CHARGE itself and may
only be compatible with a SleepNcharge USB port.
you should have your phone on its charger before connecting it
or check which ports on your device are SleepNcharge
and maybe look at turning off charging via the USB inside your
phone menu(if you get that option)

it could permanently damage both devices if you keep doing this.

I'd replace the battery NOW

there's a defect there somewhere

take it back for another one, that is not normal
and don't accept the unit as is

in fact, since this is the 2nd one, they may have a whole LOT that is bad and I'd request a replacement with a different LOT number, [[ they can tell ]]

get a replacement or a refund