Hi,
If it works OK when on the charger but not when only the battery, I suggest that you replace the [https://www.ebay.com/itm/New-OEM-Samsung-EB-BG900BBU-EB-BG900BBZ-EB-BG900BBE-900BBC-Galaxy-S5-NFC-Battery-/262168991757|battery] and check what happens. The link is only to show what the battery costs. There are other suppliers online that may suit you better. Just search for ''EB-BG900BBZ battery'' to get results.
If you decide to do this, fully charge the replacement battery in the phone, before attempting to turn on the phone.
Here’s the ifixit [guide|26918] guide, which may help.