If you divide the total distance travelled on a car trip by the time for the trip, then you are calculating average speed.
Average velocity is given by displacement divided by time taken. So magnitude of average velocity will be equal to average speed only when displacement of the object is equal to the distance travelled by the object. And it happens when the object moves in a straight line in one direction only.
For example, Let's say point B is 10m north to Point A in a straight line. If you are travelling along the straight path from point A to point B, then your displacement is same as your distance travelled, that is 10m. So in this case your average speed and magnitude of average velocity will be same.