How can a Photon have a "frequency"?

All you need is quantum mechanics, i.e. that nature in the microcosm is dual,sometimes it can manifest wave properties and sometimes particle properties.

It depends on the measurement/experiment if the wave or the particle nature will manifest itself. Electrons manifest this duality: in the two slit experiment their wave nature appears governed by the de Broglie wavelength. Photons do the same too, displaying the wavelength/frequency associated with the collective classical electromagnetic wave.

The classical electromagnetic wave is built out of photons in a consistent way, and you could study this link if you are interested in this more complicated problem.