Velocity is the rate of change of displacement. Now displacement is in a straight line in a specific direction. Hence, an object going on one direction and then coming back will cancel its velocity. You can calculate velocity by dividing the displacement by the time taken.
It is a vector quantity; hence, you need to mention the direction of the velocity when you are quoting the value. Like acceleration, velocity, has a specific direction. However, speed and distance do not have directions and can be quoted without mentioning it. These are rules of physics and allows physicists to calculate different quantities effectively.