An early attempt at building a steam locomotive took place in France in 1770, on the part of one Nicholas-Joseph Cugnot. This locomotive did operate, for a small number of trial runs, before being abandoned.

This photograph is of a model of his locomotive, held in an exhibit operated by the Baltimore and Ohio railroad.
The same is true of this photograph,

of Richard Trevithick's locomotive, which was the first to be placed in successful continuing operation, starting in late 1801.
The engraving shown below:

is of the Rocket, which in 1829 was the winner of a competition to find the locomotive to be used by the Liverpool and Manchester Railway. George Stephenson built his first locomotive in 1814; the Rocket was largely designed by his son, Robert Stephenson, but George Stephenson collaborated with him by mail, and other employees of his firm were also involved.
This photograph, from a book about the visit of a Russian prince to the United States, shows the DeWitt Clinton, which was the very first passenger train to operate in the U.S.A., on a route from Albany to Schenectady.

Needless to say, A. P. Yates' copyright in this image has expired by now.
The DeWitt Clinton dates from 1831, and was operated by the Mohawk and Hudson Railroad. It was named after the then Governor of the state of New York.
Bachmann Industries, a well-known maker of model trains, had made a model of this train at one time, and is planning on making one available again soon.
One T. F. Budden is credited with taking this photograph of the famous British steam train, the "Flying Scotsman".

And here's another illustration of what an old-fashioned steam locomotive looked like:

This happens to be an illustration of the "Challenger" locomotive, built by ALCO.
Shortly before diesel locomotives took over from the steam locomotive, some steam locomotives were given a streamlined design in order to make them look more modern and appealing.
One example of this is the locomotive used with the "Hiawatha" train:

Another is this locomotive, aptly called "The Bullet":

Here is a Hudson locomotive used by the New York Central railway:

perhaps closest to what many generally think of as the appearance of streamlined steam, from a photograph generously donated to the Library of Congress and placed in the public domain by Gottscho-Schleisner Incorporated.
This is a class S-1 locomotive from the Pennsylvania Railroad, as placed on display at the 1939 New York World's Fair;

from a photograph generously donated to the Library of Congress and placed in the public domain by Gottscho-Schleisner Incorporated.
And here is a streamlined steam locomotive belonging to the B&O Railroad. Which, in the world of railroads, stands for the Baltimore and Ohio Railroad; not for Bang & Olufsen, as it does in the world of high fidelity.

The T-1 streamlined steam locomotive from Baldwin had a rather different appearance:

Diesel locomotives replaced steam locomotives because they had lower operating costs. The danger of the boiler of a steam locomotive exploding meant that these locomotives required frequent inspections and maintenance. As well, along the way, they had to be frequently supplied with water.
One of the earliest diesel locomotives had an engine made by the Winton subsidiary of the Electro-Motive Division of General Motors, put in a streamlined body designed by Pullman, the famous maker of passenger cars:

This M10000 was commissioned by Union Pacific, and put into service as the City of Salina.
And here is a streamlined diesel locomotive from Baldwin:

The type of diesel locomotive many of us remember from our childhoods looked like this:

or like this:

Today, though, the diesel locomotives you are likely to see pulling trains will look more like this:

This design, while less appealing to the eye, offered a number of practical advantages. It was easier to get at the diesel engine inside the locomotive for maintenance. It was possible to stand on the train, but outside of it, so as to have a good view of the train's coupler when it was being coupled to another car in front of it.