How do photons travel at a speed that should be impossible to attain?

Massless particles don't need infinite energy to jump at $c$. Photons don't have rest mass as they don't interact with Higgs field.

What you have heard is applied only for mass. The whole thing works like this:
In relativistic physics, mass isn't constant. It is increased when its speed is increased. It is driven by this formula: $$m=\frac{M}{\sqrt{1-\left(\frac{v}{c}\right)^2}}$$ where, $m$ is relativistic mass, $M$ is rest mass, $v$ is speed.

So, at higher speed, we need higher energy to accelerate mass because it has been increased.
In case of massless particle, let's apply this formula:

  1. When $v$ is less than $c$: If you divide $0$ by a positive number, the result would be $0$. So, to accelerate $0$ relativistic mass particle, you wouldn't need energy. That's the reason why you can't find a massless particle at speed lesser than $c$.

  2. When $v$ is equal to $c$: Formula isn't valid because $0/0$ is not defined.

Note: While the answer is fine for general massless particle, it's not good for photons (ask relativistic physicists). Relativistic equations have $c$ due to the fact that it is a postulate of Einstein that photons already have this speed. So, it's not good for us to get to there in reverse.
So, answer for relativistic guys: Its framework for Relativistic Physics. We never needed to accelerate photons to $c$. It was already running at this speed.


If it requires infinite amount of energy to travel at the speed of light then how photon attains this speed

That's not quite right. You're thinking of the energy required to accelerate a massive object to $c$ which is impossible thus the infinity.

However, there is no reference frame in which photons are at rest. An object with speed $c$ in one frame has speed $c$ in all frames (thus the invariant speed).


According to special relativity

$$ \frac vc = \frac {pc}E = \frac {pc}{\sqrt{(mc^2)^2+(pc)^2}} $$

For $m=0$ we have $pc=E$ and thus $v=c$, whereas for $m\not=0$ we have $pc<E$ and thus $v<c$.