it could be the battery it could be the charger it could be the outlet its plugged into.
it could even be the laptop is hot and the heat is throwing off its sensor
first make sure that you are using the correct charger if you have more than one in the house. Just because it fits the slot doesnt mean it will work correctly with a different laptop than it came with
try removing the battery and plugging the charger it. if it boots up and works than the issue is with the battery. Luckily if it is the battery it should still be under warrantee from hp.