If it is inelastic collision, part of mechanical energy is converted into internal energy. This is due to the heat generated during the collision.
Definition of elastic collision: In an ideal case, after an object collides, the deformation can be recovered without loss of heat, sound and kinetic energy. This kind of collision is called elastic collision, also called complete elastic collision. True elastic collisions only occur between molecules, atoms and smaller particles. In life, when hardwood balls or steel balls collide, the kinetic energy loss is very small and can be ignored. Their collision is usually considered as elastic collision.
Look at this definition, it may be better understood.