Dear student,
This only happens for one special ray. The ray that is parallel to the optical axis and goes through the center of the lens. All other rays are deviated (either in angle, displacement or both) to some extent.
This happens as the center of a spherical lens is along the line joining the centers of curvature of the two surfaces. A ray going through these has an incident angle of zero at both surfaces and is undeviated. No other ray has this property. A ray is deviated even at a window if it does not hit the window glass normally. (The centers of curvature in this case are at infinity.)
Regards