This topic is never explained properly; I sympathise with your doubts and confusion. Let's start with temperature. What is temperature? Temperature is a measure of the average kinetic energy of particles. The Maxwell-Boltzmann distribution function describes how the kinetic energy of particles behaves when the average temperature is changed. See the figure below. Notice how the change of temperature from 300K to 600K lowers the peak, but spreads the kinetic energies to much higher values.
Next, we need to bring in the potential energy/reaction co-ordinate model, as mentioned by
@someth1ng. Only molecules that possess more than the required activation energy E
are candidates for overcoming the activation barrier. Notice how, as the temperature increases, the M-B Distribution function allocates more of the available kinetic energy to the upper "tail" of the distribution. Now, reactions that have a high activation energy are modelled by the vertical line E
and reactions with a lower activation energy are modelled by the vertical line E
. Compare the dark blue curve with the violet curve. Notice how the fraction of molecules that have E
doubles when the temperature changes from 300K to 600K, but the fraction of molecules that have E
quadruples when the temperature changes from 300K to 600K. Lastly, remember that all reaction rates increase when temperature increases, but reactions that have a high E
increase more than reactions that have a lower value of E
. Therefore, we conclude that the equilibrium constant K
changes if the temperature changes. It shifts in the endothermic direction if temperature increases, and so if the forward reaction is endothermic, then K
increases.