Sleeping with your hand under your head is likely and instinct that humans have developed where in the old days before pillows humans would sleep on rocks and other harder surfaces.
The hand would be used as a pillow to make it softer for their head to lay on instead of a rock or other hard surface.
A hand still is harder than a pillow but much softer than a rock etc.
I sometimes find myself sleeping with my hands under my head at times even when I have a pillow.
So it's likely just due to the instinct that humans have for living out in the wild on rocks etc before the modern houses we have today.