Why does this pipe feeding a hot water heater dip down like this?
It is highly likely that that piping arrangement is made that way to facilitate the installation of a water softener. A water softener will have a need to accept a pipe with incoming hard water and another for the outflow of conditioned water to the rest of the residence.

When a water softener is installed the U shaped fittings at the bottom of those two pipes would be removed and replaced with a new setup that usually consists of three or four valves. The valve setup allows for bypassing the softener, allowing water into the softener and also a configuration to backflush the unit. These days the whole valve system is often all integrated into a control unit with solenoid valves so that the controller can manage the flushing under electronic control.