I read that they are around 400,000 pounds(200 tons).
The friction coefficient between steel wheel on steel rail is rather low (half of what rubber on asphalt is), and the pulling power is directly proportional to the friction coefficient multiplied by the weight above.
So, a 200 tones locomotive would be able to generate twice the pulling power of a 100 ton locomotive.
The heavier the locomotive, the more pulling power. So, why not go all out and have 1000 tons locomotive then, you may ask? Because at that weight, the rails would deform and bend.
They are heavy because the have a honking big diesel engine, generator and traction engines in there
And there is no point making them lighter, because they need that weight to get traction to move the train.
If you made a nice light train, maybe with aluminium, fibreglass and a gas turbine engine, it would be useless. Every time the driver put on the power the wheels would spin.
The issue is adhesion. Locomotive driving wheels touch the tracks only at a tiny point; they are not like rubber tires which deform to fit themselves to the roads. There are two ways to gain adhesion: Use more driving wheels or make the locomotive heavier.
Because it needs to pull heavy loads. If it were too light, it wouldn't be able to get the traction to pull a mile of loaded cars.
Because the engines need to be heavy to generate enough power to move the train.
They are just so heavy because of the adhesion involved.