Bluing is used for tradition, appearances, and because it slows rust formation on the metal.
Bluing is just a coating to protect metal surfacecs. It's been around for hundreds of years
Caustic bluing has only been around about a hundred years. It is cheap, and it provides some protection against rust. Before that, there were other forms of bluing, primarily different forms of rust bluing (which is probably why caustic bluing is so common nowadays). Many, many firearms prior to the late 1800s were left in the white. The brown patina we associate with old firearms is rust. Nowadays, environmental protection and safety laws frown upon high pH waste being dumped in landfills and such.
Although paint has been used, it was generally not resistant to cleaning methods used, so it had to be refreshed often. After it has been chipped and repainted repeatedly, it looks like crap, and it interferes wit smooth operation of close tolerance parts. So people who care about how their guns look and function generally do not want paint.