Acceleration is the rate of change of velocity. i.e change in velocity with respect to time(see equation at the end.)
In the first case for a straight line parallel to x axis. At two points in y axis (representing time), x co ordinate is same i.e no change in velocity, hence acceleration is zero for constant uniform velocity.
In second case the velocity at two points on y axis are not same hence does not become zero, when subtracted, hence we say that acceleration is positive and not zero.
Acceleration a = (v2 - v1)/(t2 - t1)
Hope this helps :)