Hardware refers to the physical parts of a computer. The term is used to distinguish it from the software (programming) or the data. In the earliest days of cumputing, the computer had to be physically changed to reprogram it Later, when the programming could be changed without making a physical change in the machine, there came a need to be able to distinguish between the physical machine and the programs it ran.
While programs while running have physical electrons moving, or the data encoded on a hard-disk has a physical magnetic property they are not hardware.
Hardware can have physical failures or can have problems in design (see Pentium Bug).
The term firmware is used to denote programming (or data) that is encoded in non-volatile memory or chips such as EEPROM, CMOS, or BIOS.