It's wasn't necessarily the railroad that "used" the engine; it was often the railroad that first created the engine. The NYC, for example, is generally credited with building the first 4-6-4, so they basically got naming rights (Hudson). The Northern Pacific was generally credited with being the first to use a 4-8-4 (Northern). And Mikado? While not the first 2-8-2s, a batch was later built that went to Japan. Mikado means "Emperor of Japan."
Big Boy? that's an easy one too. Maybe HW can elaborate on the anonymous Alco employee who scrawlled the name on the engine's smokebox in chalk. Seemed an apt moniker for an engine so large.
2-8-0 Consolidation? Simple--named for the "consolidation" of a number of railroads that became the Lehigh Valley in 1866.
"Mogul" for 2-6-0? Well, they were big!
4-4-0 Americans? Well, virtually every road in America used 'em, so naturally.
Now Baldwin? Careful--that's not a steam locomotive name--that's a locomotive manufacturer's name--formally the Baldwin Locomotive Works of Phildadelphia, PA. They built Americans, Hudsons Moguls and Northerns, along with tens of thousands of other designs.
There's an accepted name for virtually all steam locomotives. Only engines like 0-4-0s and 0-6-0s didn't get "real" nicknames (they're "four-coupled" and "six-coupled," respectively). And most have a good story, so have fun in your research.
And just remember naming wasn't often so straightforward. For instance, today we think of a Hudson as a far different locomotive than some people thought of in the 1880s: