Water heater temperature is one of the few household settings with a real argument on both sides.

The case for 120°F
Scalding. At 140°F, a serious burn takes a couple of seconds. At 120°F it takes minutes. That difference matters most for young children, elderly people and anyone with reduced sensation or mobility.
Standby loss. A hotter tank loses more heat to the room continuously.
Scale. Mineral deposition accelerates with temperature, so a cooler tank scales more slowly — which matters in hard water.
120°F is the figure most commonly recommended, and many heaters ship set near it.
The case for 140°F
Legionella. The bacterium grows in warm water and is suppressed above roughly 140°F. It causes a serious pneumonia, contracted by inhaling aerosolised water — from a shower, for instance.
The risk is low in a typical household and higher where there are immunocompromised occupants, long pipe runs, or periods when the system sits unused.
More usable stored heat. Hotter water means each gallon goes further when blended at the tap, so the tank effectively holds more.
The arrangement that resolves it
Store hot, deliver warm.
Set the tank to 140°F and fit a thermostatic mixing valve at the outlet, blending it down to 120°F for distribution.
That gives bacterial suppression in the tank, a safe delivery temperature at every fixture, and a larger effective tank capacity than the same tank at 120°F.
Mixing valves are inexpensive, they are required by code in some jurisdictions for exactly this reason, and they are the standard answer when a household is one shower short of comfortable.
Point-of-use protection
Separately from the tank setting, thermostatic mixing valves at the fixture — particularly at baths and showers — protect against both scalding and the sudden temperature change when another fixture is used.
Modern shower valves are generally pressure-balancing or thermostatic and do this already. Older ones do not, and a bath filled from an old valve in a house set to 140°F is where scalding actually happens.
Adjusting it
Gas heaters have a dial on the control valve, often marked in vague terms rather than degrees.
Electric heaters have thermostats behind access panels, one per element, adjusted with a screwdriver. Both must be set to the same temperature, and the power must be off — the terminals behind the panel are live.
Verify with a thermometer at the nearest tap after the tank has recovered, since the dial markings are approximate.
The other settings
Vacation mode holds a low temperature while away. Worth using for anything beyond a few days, and worth running the taps hot on return before showering, to flush any water that has sat warm.
Turning the heater off entirely for a long absence is fine, and the same flush applies on return.
Where the real risk sits
For most households, scalding is the more immediate hazard and legionella the more remote one.
For a household including anyone immunocompromised, that ordering can reverse, and the mixing valve arrangement is what avoids having to choose.
Dishwashers
Older dishwashers relied on the incoming water being hot, and 140°F was partly a dishwasher requirement.
Current machines have internal heaters and manage with 120°F supply, which removed one of the arguments for the higher setting.
Energy saving from turning it down
Lowering the setpoint reduces standby loss, which is the heat escaping from the tank into the room continuously.
On a modern well-insulated tank that loss is modest, so the saving from a ten degree reduction is real and small. It is not a reason on its own to accept a household that runs out of hot water, and the mixing valve arrangement gives most of the benefit without that trade.
The larger saving in most houses is insulating the first several feet of hot water pipe leaving the tank, which is cheap and takes an hour.