The straightforward answer is their purpose is to establish bearing preload, they should be adjusted so that the hub bearings are as loose as possible without play, and they should be tightened against one another to about 15-17 Nm. (Those are Shimano's generic values but the same numbers can be used pretty safely for locknuts on pretty much any steel hub axle. If you don't have a torque wrench, or the ability to get one on there, just making them nice and tight is fine.)
Usually on hubs like this you're tightening the pair of nuts on each side against one another to lock the adjustment in place. If you were to instead to tighten the inner locknuts (the ones that contact the bearing inner races) down towards each other and then outer locknuts down onto them, you'd tend to end up with a preload adjustment that's too tight.
In reply to the edits: on one side, turn the locknut finger tight against the bearing, then lock it in place with the other locknut. Repeat for the other side.
As to what is the purpose of them, there's a significant hub design element to this question, in that there are many cartridge bearings hubs with no adjustability, where on either side a single nut or endcap pinches the bearing inner race against a shoulder on the axle, instead of a hub like this with preload adjustment via a pair of locknuts. A few hubs like the one pictured use what's called an angular contact bearing and have unshouldered (aka standard) axles, and therefore need the locknuts so they have some way of establishing preload, but most have shouldered steel axles.
I don't know what a hub designer would say about it but I suspect that a reason why a lot of nutted BMX and track hubs with shouldered steel axles are like this is that with only a single locknut per side, it would be too easy for those locknuts to come loose in the process of loosening and tightening the axle nuts. They also may be something of a perceieved insurance policy against tolerance issues between the bore-to-bore spacing on the hub shell and the shoulder-to-shoulder length of the axle, because then even if the axle shoulder spacing is a bit under at least you can use the locknuts to have one inner race be pinched firmly between shoulder and locknut while the other inner race floats on the axle.