I was just thinking about how electric field and magnetic field vectors oscillate in a Photon. but then I remember that a photon doesn't experience any time so how can these vectors oscillate if the time experienced by the photon is zero. According to Lorentz transformation formula, particles which are moving at the speed of light (in our case Photon) will experience infinite time dilation which basically means that time experienced by them is zero so if that happens to be the case then why the electric and magnetic vectors oscillate. If time experienced by the photon is zero then they should be anything happen at all but still the oscillations are happening?
This answer addresses this part of the question, in contrast to the duplicate which addresses only the title.
I was just thinking about how electric field and magnetic field vectors oscillate in a Photon. but then I remember that a photon doesn't experience any time so how can these vectors oscillate if the time experienced by the photon is zero.
A photon, an elementary particle in the standard model of particle physics, has as measurable quantities its energy and momentum, its spin and its mass which is equal to zero. It does not have a measurable electric or magnetic field.
The question then becomes how does the classical electromagnetic wave emerge from the summation of photons, since it has no measurable electric and magnetic field, whereas the classical wave does.
It is because it is a quantum mechanical entity described by a complex number wavefunction :
This wave function is derivable from a quantization of the Maxwell equations, the link gives one possible version of this. As should be known , the wavefunction itself is not measurable, as it is its square that will give the probability of finding the photon at (x,y,z,t). Finding implies observation.
The classical beam emerges from zillions of photons by a superposition, generating the collective wavefunction of the classical electromagnetic wave. How this happens in quantum field theory is described in this blog article. It is in measuring the square of this collective wave function that the E and B fields can be measured.
The difference between superposition and interaction can be seen in this laser video, where the superposition of photons in light beams generate interference patterns, although there are no photon photon interactions (just photon lasing source interactions).
The photon has no consciousness, to "know" space and time. It is the observation in a system of spacetime that defines the variables. And observables can be measured according to the probability distribution emerging from the underlying quantum mechanical framework.
I think you need to be more careful here... There's are classical and quantum treatments of light, and one must take care to not confuse them, and to keep them within their respective ranges of validity.
Classically, light is treated as a wave that experiences diffraction, interference, refraction, etc..... This is where electric and magnetic fields come in: an elecromagnetic wave is a classical model of a ray of light, in which the fields are mutually perpenidicular and oscillate in time in the plane perpendicular to the direction of wave propagation.
In classical special relativity and relativistic electromagnetism, a ray of light (or equivalently, a photon's worldline) is a null vector of the Lorentzian manifold and we lose the model that light is made of electric and magnetic fields oscillating in time. Instead we deal with the electromagnetic (or Maxwell) tensor, because now time is a variable instead of a parameter like in non-relativistic mechanics.
So, indeed, photons in relativistic theories do not "experience" time, but in these theories the notion of electromagnetic waves as oscillating in time doesn't make sense.
In General Relativity, the electromagnetic tensor can be used as a source for energy-momentum (since the fields carry momentum) which effects the curvature of spacetime. One can also derive radiation laws for the electromagnetic tensor source, for instance this paper considers electromagnetic radiation in the FRW spacetime.
The nature of light is twofold: you have to distinguish between the observer-independent absolute reality (the spacetime interval) and observation.
Lightlike phenomena such as photons have a spacetime interval zero. Such an empty spacetime interval means that nothing is found between the spacetime point (event) of emission and the spacetime point of absorption of the photon.
For understanding the apparent contradiction with the electromagnetic wave it produces you have to understand what a Minkowski diagram is.
Every Minkowski diagram belongs to an observer, who observes the universe as a continuous manifold (the rectangle of the Minkowski diagram). In the Minkowski diagram the Pythagorean distance between the point of emission and the point of absorption is not zero, although the spacetime interval is zero. As an example, if a photon is traveling from Sun to Earth we do not observe that the Sun at time x and Earth at time y are adjacent. For observers, there is a gap between both points although the spacetime interval is zero. The momentum transfer of the photon from Sun to Earth is observed as an electromagnetic ray.
In summary, you must simply distinguish between reality and observation. The spacetime interval represents the "real" value all observers are agreeing on. In contrast, as it is said by the second postulate of SR, light is "observed" as moving at speed of light c.
1) The Lorentz transformations apply to the macroscopic reference frames (RF), not to elementary particles. The Lorentz transformations connect some observation results obtained in one RF with similar observation results obtained in another RF.
2) In a trasparent medium a photon moves with the velocity smaller than $c$, and massive particles can move faster than this photon (see the Cherenkov's effect, for example).
3) A photon does not "experience itself". Its properties get into the equations of motion of other particles, so it is other particles who "experience a photon".