50mm is the focal length of the lens. The 52mm refers to the front diameter of the lens thread. Most filters are threaded onto the front of a lens, so in your case, you need a 52mm filter for the 52mm front thread diameter on your 50mm f/1.8.
Lenses with faster f/stops tend to have larger front openings, since the f/stop is the ratio of the lens's focal length divided by its maximum aperture opening. Therefore, a 200mm f/2.8 needs to have a maximum diameter opening of about 71.5mm, and as such uses a large 77mm filter thread. It is often possible to use larger filters with a step up ring on your 50mm lens; usually, using a 77mm filter on a lens with a 52mm filter thread won't cause any vignetting.