The photoelectric effect is a simple experiment explaining how photons can have an energy proportional to their frequency, provided one is okay with light being divided up into chunks known as photons.
That being the case, scientists have shown that with high frequency light, you can knock electrons off pieces of metal. The brighter that light (the more photons), the more electrons get knocked off, and we can measure these electrons hitting detectors.
However, at low frequencies, no electrons get knocked off the metal, no matter how bright the light is.
We know that if the photon has enough energy, it can knock an electron off, and it can't if it doesn't.
More importantly, we can measure the kinetic energy of the electrons that get knocked off and see that the higher the frequency of the light, the higher the kinetic energy of the ejected electrons.
This relationship between electron energy and frequency of the incident light is precisely what we expect if we say the energy of a photon is proportional to the frequency of the light it's a part of.
It's hard to think of photons on their own, but if a photon is just a very tiny part of a beam of light, then it makes sense to speak of the frequency of a photon as the frequency of the light it is part of.