He is performing full ablution, or Ghusl. Ghusl is a full-body, extremely thorough wash, necessary after performing ‘unclean’ acts or coming into contact with ‘impurities’. It can be done with water, or if lacking any, sand/ground.
If you’re interested, there are a lot of resources online that explain what it is (in more detail) and what the process is like.