The average velocity is the ratio of total displacement and time.The.average speed is the ratio of total distance and time.
Therefore the average speed and average velocity are equal if the total displacement is equal to the total distance that is if the body travels along a straight line without changing the direction.