Jiu Jitsu is the unarmed martial art of the medieval warriors of Japan - the Samurai. To understand the history of Jiu Jitsu is to first understand the history of the Samurai.
The Samurai were men of noble families and were somewhat akin to the knights of Europe. Each Samurai was a military man which meant that he must study the art(s) of war. This in turn led to each family developing its own particular style of fighting. These styles were based around the weapons of the era - swords, polearms, staff and bo. Supplementary arts were also developed - horse riding was very important (joba jitsu) and killing was not always desired leading to arts like hojo jitsu (restraints with rope).
This was of course how Jiu Jitsu came to be created. Jiu Jitsu was developed from many of the more weapon oriented arts drawing upon thrusting, cutting and importantly disarming and restraining techniques. The art of Jiu Jitsu was developed so that a Samurai who found himself without his weapon(s) could still defend himself effectively. Jiu Jitsu was the battle field art of unarmed combat.
As well as the majority of the armed arts, Jiu Jitsu is also believed to owe many of its fundamentals to influence from the Chinese martial arts, though the style is typically not as flowing and quick as the Chinese arts (which are believed to have been derived from even earlier martial arts from India). This is probably because as well as carrying weapons the Samurai also wore armour into battle. Thus Jiu Jitsu is an art that was compatible with fighting in armour and against armoured opponents. This caused the development of Jiu Jitsu to include locking, throwing and pinning techniques as well as the more common place kicking and striking techniques of other martial arts.
Jiu Jitsu was heavily refined over the years and through a survival of the fittest process techniques were refined and improved upon. Several traditional schools survive to this day, but many more have died out and many others find that they are not a "pure" style, but a hybrid or evolutionary one like Shorinji Kan.