@lore from the perspective of object A it was the object B that struck it and vice versa, but the energy was already contained in their relative momentums, in which case they together make a "closed" system containing all of the energy to be released when they collide.
As for the random particles, AFAIK they are created by some existing energy, like you lifting a ball from the ground and that's the energy they release when they come back together, like the ball falling back down.
There's a lot of interesting cases, but every time you think energy is gained, even if temporarily, it comes from something yet unaccounted for :/