How can a photon of a particular energy be supplied to a sample of gas to excite the electrons? I have recently started reading about atomic spectrum of hydrogen gas.
To excite an electron of a hydrogen atom the photon that collides must have exactly the same energy as the energy gap between the initial and final states.
However a photon also carries momentum and hence after it is absorbed the hydrogen atom must have some kinetic energy.
But that would imply that the remaining energy of the photon was used to excite the electron but since some of the energy is converted into the kinetic energy of the atom how is there enough energy to excite an electron?
I don't understand how we could possibly excite electrons then. I'm not experienced enough in this subject to find out if there is a mistake in my understanding or if I am using particle/wave nature of light where it shouldn't be used
 A: Absorption line profile
The energy needed to excite an electron isn't one exact value, but is an energy distribution, albeit a very narrow one. The reason for this can be traced back to Heisenberg's uncertainty principle: The width $\Delta E$ of the distribution is given by the half-life $t_{1/2}$ of the excited state, as $\Delta E \times t_{1/2} \sim \hbar$, where $\hbar=h/2\pi$, with $h$ the Planck constant.
This distribution gives the intrinsic, or "natural" absorption line profile, which is a Lorentzian. In practice, the atoms of a gas will have non-vanishing thermal motion, which gives rise to a Gaussian velocity distribution. This means that, even if the photon is rather far from the line center, there is a probability that there exist an atom with the right velocity along the path of the incoming photon to Doppler shift the photon into resonance.
In effect, the total line profile hence becomes a convolution of the Lorentzian and the Gaussian, which is a Voigt profile. This profile is dominated by the Gaussian close to the line center, and by the Lorentzian in profile wings.
The figure below shows the natural Lorentzian (blue) and the thermal Gaussian (red), as well as the total Voigt profile (yellow and black dashed), as a function of number of Doppler widths (standard deviations of the Gaussian) from the line center. Note the logarithmic $y$ axis.

Recoil effect
But you're right that the incoming photon adds momentum and hence kinetic energy to the atom. The same is true for the re-emitted photon. If the photon is re-emitted in the exact same direction as it was traveling, the net effect will be zero (it first pushes the atom along its path, then pushes it back again). In general the outgoing photon will have another direction though, and so the net effect of this recoil will be that the photon loses a bit of energy.
However, it turns out that this energy is minuscule compared to the energy that the photon gains or loses due to the motion of the atoms. For resonant photons, Field (1959) showed that, for one absorption and re-emission (i.e. a scattering), a photon loses a fractional energy of
$$
g = \frac{h\,\Delta\nu_D}{2 k_\mathrm{B} T},
$$
where $\Delta\nu_D$ is the line Doppler width in terms of frequency, $k_\mathrm{B}$ is Boltzmann's constant, and $T$ is the temperature of the gas.
Except for very low temperatures, this effect is negligible compared to other processes.
