Hand grenades were used off and on since the invention of black powder, appearing in small numbers in such conflicts as the American Civil War. However, they did not really come into common use until the trench warfare of World War I made them invaluable.
Interestingly, the glass Civil War model led to an intruiging peacetime use - the glass bottle fire extinguisher grenade. Made from the mid 1800s to the early 1900s, these glass bottles were filled with water and fire retardant chemicals. They were to be thrown into the fire and shattered. The water and chemicals would mix and produce a retardant gas.
In World War I, enterprising troops began to make primitive grenades with jars filled with gunpowder, rocks and a simple, often unreliable, fuse. The ideal fuse burned about three to five seconds -- enough time to throw the grenade into the opposing trenchlines, but not enough time for it to be caught and returned.
As the utility became obvious, standard grenades started to appear. The german "stick" grenade was tossed more like a knife, as opposed to the baseball-like American models.
The tendency of a grenade to explode messily, killing anyone nearby leads to the expression "Close only counts in horseshoes and hand grenades" - although in the modern era we have many other weapons of mass destruction that qualify for similar reasons.