Dear Student,
It is so because the forces are acting on different bodies, hence they don't cancel each other.
Newton's third law states that "If a body A applies F force on a body B then body B also applies force -F on the body A."
Here negative sign represents the opposite direction of F.
So, as you can see that though the two forces are equal in magnitude and opposite in direction, they act on two different bodies hence they don't cancel each other's effect.
Regards.