It is due to the property of a liquid which is called viscosity. The viscosity of a liquid opposes the relative motion between layers of the liquid. The layer of the water in contact with the river bed is still because the river bed has no movement. The layer above it moves with some speed due to the resistance of the lower layer. And each layer moves with some relative speed than its lower layer. Thus a velocity gradient is formed with zero at the bottom and maximum near the surface.