When you think about it, battery can have a lot of different meanings. The most common way we use it is to refer to the cells that power so many devices like our phones.
But it can also be used to refer to physical beating (e.g. assault and battery) or a military attack like a bombardment. You can see how both of those uses share a sense of violence, specifically striking, so how is it that also use the word battery to refer to the little thing in our phones?