Electronic components are built to a price. This is not stinginess on the part of manufacturers, the majority f customers do not know enough to put value on quality and shop by price.
As a classic example, computer power supplies will typically use cheaper electrolytic capacitors which are fine initially but tend to dry out and cause major failures after 5 to 10 years, even if the unit just sits on a shelf. With luck the PC will be retired or get minimal use by the time it is a big risk, but one of the things a sensible enthusiast will always do when building a PC is make sure the PSU has Japanese Electrolytics that have a much longer life.
TLDR electronic devices do eventually fail over time, even if not in use. Mechanical components do occasionally rust or seize over time as well but the issue is not near as serious as with electronic parts.