Some trenches are where the water pipes go. They will be underground after the dirt is put back in. Other trenches are dug so that steel bars for reinforcing can be put in before the cement is poured. After the cement dries it becomes hard concrete . This will be part of the foundation that holds up the building, and the walls, and makes the floor.
Sidewalks are concrete and are also made of cement.
It is used in building a foundation because it is so strong. The concrete that goes into these trenches form the footings . Think of footings as feet for the building. I need strong feet to stand up when the wind blows. Here you can see some the the wood that is being put along the trenches.