Spectra of electromagnetic radiation emitted during solar flare During solar flare, electromagnetic energy is released at a wide range of wavelengths but the most dominating are x-rays and extreme ultraviolet rays. Why is that intensity of these wavelengths is greatest?
Flares involve releasing huge amounts of potential energy that are stored in stressed magnetic structures in the solar corona. So-called reconnection events can release this stress but at the same time accelerate charged particles to high energies. These are trapped along the magnetic field lines, spiralling around them, but travelling until they hit the footpoints of the loop that are anchored in the solar chromosphere and photosphere. The much denser plasma here is sufficient to stop the charged particles and this is where they dump all their kinetic energy, some of which is promptly released in the form of non-thermal hard X-rays, which are insufficient to cool the plasma.

The plasma heats up, increases its pressure and it expands to fill the overlying magnetic structures - a.k.a. chromospheric evaporation. This hot plasma radiates and because it is at temperatures between $10^{5}$ and $10^7$ K, most of that radiation is emitted at EUV and X-ray wavelengths in free-free and transitions in highly ionised species.

I guess the root cause as to why the plasma can get up to these temperatures is that the radiative and conductive cooling processes are much slower than the heating processes caused by the accelerated charged particles.