It is really complicated to do the analysis, and there are lots of incomprehensible academic papers about this and the related question of how to design a baseball bat.

But, the very simplest explanation uses conservation of momentum (=mv) , which applies to all bat - ball collisions, plus the assumption of an inelastic collision, which causes loss of kinetic energy (=0.5mv^2) during the collision. Solving these equations show that a heavier bat makes the ball go faster after hitting it, see e. g. Wikipedia page on inelastic collisions. But only for the same swing speed, and we all know it is harder to swing a heavier bat fast. But, the equations also show that the ball speed depends on a coefficient that can be thought of as the pinginess of the bat, so that's likely to be just as important.

So that's why we all have a different ideal bat weight, depending how strong and quick we are, and a pingier bat is always better.

Anyway, ignore if this makes no sense, but it does rely on physics and is a bit more complex than 'f=ma' alone.