The reason is that a photon has energy in proportion to its
wavelength, and the constant of proportionality is the Planck
constant. Below a certain frequency -- and thus below a certain
energy -- the incident photons do not have enough energy to knock
the photoelectrons out of the metal. Above that threshold energy,
called the workfunction, photons will knock the photoelectrons out
of the metal, in proportion to the number of photons (the
intensity of the light). At higher frequencies and energies, the
photoelectrons ejected obtain a kinetic energy corresponding to
the difference between the photon's energy and the workfunction.