Samsung Galaxy S5 died suddenly and without reason
This is likely a defective battery or similar. Seeing as you have just bought it, I'm not surprised that it is showing this behavior. You could probably pull up your warranty (assuming you haven't rooted it) and get it fixed for no charge.

In case it is not a defective battery, hold down the power button in addition to holding both volume button for about 10 seconds or so. If that doesn't turn it on I'd treat it as defective and get it fixed/replace the battery yourself (probably voids warranty, be careful)