The sidewalk or pavement as it is called in British English is a raised paved area beside the road.
The idea is to keep the pedestrian away from the mud, horse muck, ox droppings and raw sewage running down the street. In the days before mains sewers and tarmac roads, the road was the conduit not only for traffic, but for waste water, rainwater and sometimes sewage.
The concept is surprisingly ancient : The excavations at Pompeii for example have clear pavements beside the larger roads, as well as stepping stones to help cross from one side of the road to the other with dry feet.
In modern times the pavement has developed a secondary use of defining the area used by wheeled traffic and pedestrians.