It wasn't losing HP because it was Shiny actually. Greninja was holding a Life Orb, an item that increases the amount of damage dealt by the holder roughly 30%. However, it will remove 10% of the Pokemon's health with every attacking move they make. The Life Orb damage was what damaged and eventually knocked out the Greninja.
This is of course assuming that it was using attacking moves each turn, though. If it wasn't, perhaps you'd used Leech Seed or Toxic or a similar move and forgotten? It could also have been holding a Black Sludge, but the game make it clear that it'll damage you unless you're Poison type, making that unlikely.