Chosen Solution

My phone shuts down a few minutes after being unplugged. I have factory reset it and tried many other things none seem to work. Is it a battery problem?

Seems like a dead battery to me. You can buy a battery and follow the remplacement guide (Nexus 5 Battery Replacement) for changing it or search a repair shop near you to do it for you.