Energy is conserved. The electron loses kinetic energy in the collision and emits a photon with the energy equal to its kinetic loss. This is why bremmstrallung is an issue in fusion research, it cools the plasma via emitting x-rays.
I don't know why bremmstrallung occurs sometimes while other times the collision is elastic, but I think Gamma"Gamma-Ray Astronomy" by Stacy and Vestrand has a chapter on the subject.