Reason for negative Joule Thomson coefficient of Helium and Hydrogen at NTP conditions
Note: You can skip section I, and go straight to section II and/or the end of section III (specifically the conclusions subsection), if you are already familiar with the basic mathematical machinery/definitions

I. Preliminaries



Feel free to skip all of this if you are familiar with it

First, we have an adiabatic expansion, i.e $\mathrm{q} = 0 $.

Second, our process is carried out as follows: a gas at pressure $p_i$ flows into a region of lower pressure $p_f$ without significant change in kinetic energy. This is called the Joule–Thomson expansion. 

Obviously, this process is inherently irreversible. Additionally, one can show that this expansion isenthalpic (i.e $H_i = H_f$). Unlike a free expansion, work is done, causing a change in internal energy; the exact specifics of this change will depend on the initial and final conditions and also on the nature of the working fluid. 

What we measure experimentally is a change in temperature with respect to pressure at constant $H$, and we call it $\mu_{\mathrm{JT}}$ (Joule-Thomson Coefficient).

$$ \mu_{\mathrm{JT}} = \left(\frac{\partial T}{\partial P} \right)_H = \frac{V(T \alpha-1)}{C_p} \tag{1}$$

where $\alpha$ is the coefficient of thermal expansion $$\alpha = \frac{1}{V}\left(\frac{\partial V}{\partial T}\right)_p$$

All real gases have an inversion point at which the value of  $\mu _{\mathrm  {JT}}$ changes sign. The Joule–Thomson inversion temperature, depends on the pressure of the gas before expansion.

$$\begin{array}{cc}
\hline
\text{Temperature} &amp; \text{sign of}\ \partial P &amp; \text{sign of}\ \mu _{\mathrm  {JT}} &amp; \text{thus sign of}\ \partial T \\ \hline
\text{below  inversion temp.} &amp; - &amp; + &amp; - \\
\text{above inversion } &amp; - &amp; - &amp; + \\ 
 \hline
\end{array}$$

The final pressure is always lower than the initial pressure and thus the change is always negative. Depending on whether you are above or below the inversion temperature, your change in temperature can either be positive (warming) or negative (cooling). I would like to stress that the inversion temperature depends both on the temperature and pressure.



II. Qualitative Analysis

The arguments given below might seem a little "hand-wavy"/crude, but bear with me.

$$ H = U + pV$$
$$ \Delta H = \Delta U + \Delta (pV)$$

During a Joule-Thomson expansion (isenthalpic, adiabatic), the change in $pV$ represents the work done by the fluid. 

If $PV$ increases,at constant enthalpy, then U must decrease as a result of the fluid doing work on its surroundings; the working material is using its own internal energy to do work. This produces a decrease in temperature and results in a positive Joule-Thomson coefficient.

Decrease in$pV$ means that work is done on the fluid and the internal energy increases. This can thus lead to an increase in temperature and the Joule-Thomson coefficient will be negative.

For an ideal gas, $pV$ does not change during a Joule-Thomson expansion.

As a result, there is no change in internal energy; also, there no change in temperature; and the joule-thomson coefficient is zero.

In real gases, $pV$ does change. The deviation from ideality (in general) is contained in $Z$, the compressibility factor. Thus, it would make sense if we could make some connection to it.

The ratio of the value of "real" $pV$ to that expected for an ideal gas at the same temperature is called the compressibility factor,

$$Z := \frac{pV}{nRT}$$  

For a gas, this is typically less than unity at low temperature (attractive forces dominant) and greater than unity at high temperature. 

At low pressure, the value of $Z$ always moves towards unity as a gas expands (tend towards ideality).

In general at low temperature, $Z$ and $PV$ will increase as the gas expands, resulting in a positive Joule-Thomson coefficient. 

At high temperature, $Z$ and $pV$ decrease as the gas expands; if the decrease is large enough, the Joule-Thomson coefficient will be negative. 

It follows, that for the $Z&gt;1$, Joule-Thomson coefficient will be negative and the gas gets warmer. This is the case for the gases in question at the given conditions.

A graph from wikipedia showing how the Joule-Thomson Coefficient changes sign (for nitrogen):



Note: The question originally asked about gases, but I'll make a small point about condensed phases and supercritical fluids (since you can see them in the graph). At high pressures, these phases can't respond to an increase in pressure by reducing their volume, and $pV$ increases as pressure increases. The molecules are being forced together, and such the Joule-Thomson coefficient is negative.

Of course intermolecular forces, attractive and repulsive, and the limits in which they are dominant are key in explaining the changes of $Z$, and consequently of $\mu_{\mathrm{JT}}$. This point is further developed in the next section.



III. A slightly more quantitative, but ultimately Qualitative Analysis

To see how intermolecular interactions come into play, let's look at two model systems: an ideal gas (no intermolecular interactions) and a Van der Waals gas (both attractive and repulsive interactions). 

Using equation (1) and the definition of $\alpha$ we can write 

$$ \mu_{\mathrm{JT}} = \frac{V(T \alpha-1)}{C_p} = \frac{T \left(\left(\frac{\partial V}{\partial T}\right)_p -V\right)}{C_p} \tag{2}$$

For a perfect gast $\left(\frac{\partial V}{\partial T}\right)_p = \frac{V}{T}$ and so, $ \mu_{\mathrm{JT}} = 0 $

Since the Van der Waals gas equation is cubic in $V$, I will use the first few terms of the virial expansion and solve for $V$ to obtain $\left(\frac{\partial V}{\partial T}\right)_p$. I am omitting explicit computations, you may do them as an exercise.

$$Z = 1 + \frac{1}{RT} \left(b- \frac{a}{RT} \right)p + .... \tag{3}$$

Since $Z = \frac{p\tilde{V}}{RT}$ where $\tilde{V}$ is the molar volume of the gas; I am doing this for convenience's sake, I don't want to lug around a $n$ all over the place.

$$\tilde{V} = \frac{RT}{p} +  \left(b- \frac{a}{RT} \right) + .... \tag{4}$$

After differentiating we obtain

$$\left(\frac{\partial V}{\partial T}\right)_p = \frac{R}{p} +  \left(- \frac{a}{RT^2} \right) + .... \tag{5} $$

Substituting (4) and (5) into (2), and dropping all of the higher order terms.

$$ \mu_{\mathrm{JT}} \approx \frac{\frac{2a}{RT}-b}{C_p}$$

Now, consider the low temperature limit of this expression. The $\frac{2a}{RT}$ becomes large, and $b$ is negligibly small compared to it so

$$ \mu_{\mathrm{JT}} \approx \frac{2a}{RTC_p}$$

All the quantities on the right hand side of this equation are positive. so $\mu$ is positive. The attractive forces are dominant, since only the paramter $a$ appears in our expression.

Similarly, the high temperature limit is 

$$ \mu_{\mathrm{JT}} \approx \frac{-b}{C_p}$$

Here, $\mu$ is clearly negative. The repulsive forces are dominant, since only the parameter $b$ appears in our expression.

Conclusions


The existence of an inversion temperature becomes obvious in a gas with both attractive and repulsive forces, since $ \mu_{\mathrm{JT}}$ changes sign from positive to negative.
The connection to attractive and repulsive forces also becomes more explicit. 
In the low temperature limit, attractive forces are dominant and the gas needs to break free from these interactions as it expands. This requires energy, which has to be supplied by $U$ the internal energy of the gas. Thus the gas cools. 
At high temperatures, the repulsions are dominant. As the gas expands, the over potential is lowered, and energy is released. Thus, the gas warms up.
Obviously, the exact magnitude of the high and low temperature limit depends on the nature of working fluid, since the parameters $a$ and $b$ are different for each gas. The gases you are talking about, have barely an attractive interactions.


Caveats


Our analysis based on the Van der Waals gas seems to suggest that the inversion temperature and $\mu_\mathrm{JT}$ is a function determined by temperature alone. This has experimentally proven to be false. This discrepancy arises because we dropped the higher order terms in our expansion which contained the pressure dependance.
This model is ultimately qualitative. It will give you the wrong numbers when you try to compute something, but it explains the general trends well.