When the rock on top is of a denser material than the rock below it, it creates pressure on the lower layer (sandstone). This pressure causes a column of denser sandstone to form directly under the top rock. Because the column is denser than the other sandstone around it, it gets eroded away more slowly than the other sandstone around it.
I’ve actually been to this particular hoodoo sight, and it’s really incredible. One of my favorite parts is all around the area are these tiny little hoodoos forming from pebbles and other small rocks!