Two very symbolic and perhaps widely known components of the locomotive are the bell and the horn. Both are vital safety features, however, the bell's use predates the locomotive to the days of horse-drawn street cars and carriages. Quite simply, it alerts those nearby to the fact that the vehicle in which it is affixed is moving.
As the horn is very loud and used for widespread alert, the bell, being quieter is more practical for a constant reminder when the locomotive is nearby.
Originally, locomotives in America were very primitive. As they were steam powered, the horn was generally a brass whistle activated by steam releasing from the boiler and the bell was mounted on the top of the locomotive and connected to a long rope that allowed locomotive engineer or fireman to pull on it to ring it manually.
These days, the technology has advanced significantly. The bells are sounded by activating a pneumatic valve fed by the locomotive's compressed air reservoir.
Another significant development in the locomotive bell completely eliminates the bell altogether. New generation locomotives such as the ones at VRE use electronic recordings of a ringing bell that projects from a high volume sound projector affixed to the locomotive.