After Mars became a colder, drier place and the river disappeared, the rocky river bed remained.
In this HiRISE image, we see a dark ridge snaking across the surface. The dark ridge is the old river bed. It is raised above its surroundings now because these softer surroundings have been eroded away, whereas the rocky river bed resists that. Scientists call these ridges inverted channels and many of them are visible in this area of Mars.