To understand anti-aliasing, it important to first understand what aliasing is. Image aliasing is the "jagged edge" effect caused by mapping curved and diagonal shapes onto square pixels. Horizontal and vertical lines can be mapped perfectly onto square pixels, but angled and curved lines must be estimated. If pixels along the edge are either on or off, the result is a jagged edge, also called "stair-stepping" or aliasing.
Anti-aliasing smoothes edges by estimating the colors along each edge. Instead of pixels being on or off, they are somewhere in between. For example, a black diagonal line against a white background might be shades of light and dark grey instead of black and white. A blue circle on a yellow background might have shades of blue, yellow, and green along the edges instead of solid blue and yellow.
Aliasing is most noticeable on screens with a low DPI (dots per inch). Modern HiDPI screens have a denser grid of pixels that can represent edges more accurately. However, even HiDPI screens still benefit from anti-aliasing.