The boiler is a large, sophisticated, and expensive piece of equipment, and often serves scores of apartments that are in proximity to it. Boilers require all manner of pumps, piping and valves, and electrical systems to work. If any of those systems fails, the boiler doesn't work, and the boiler represents a single point of failure for the procurement of hot water for an entire complex.
There are probably other ways to deliver hot water, but this is one of the most common due to cost effectiveness, at least in the current economic moment. No boiler? No hot water.