The history of the self-defence system that we know as Martial Arts dates back at least 2,500 years. In 327 BC, Alexander the Great invaded India. While in India, he taught boxing and wrestling to the Indian warriors. However, India's claim of being the beginning of the martial arts is disputed by Chinese historians. The Chinese use documents dating from the 4th century BC to prove that Han emperors supported the study and refinement of Kung Fu. This was a more advanced system than anything being done in India at the time.
There are many different views on how the fighting systems started. My view is that whereever people existed and fought they eventually developed some kind of defensive strategy.
There were family tribes that fought against one another. If their method of overcoming the enemy was successful, then it was taught to others in the group, so that all over the world many different fighting systems evolved.
As the world became smaller because of long distance trade many ideas were swapped from one group of people to another. I believe that one or more of these family groups travelled from India to China.
One of the objects of Buddhism is meditating for long periods at a time. Their lack of physical and mental stamina meant they could not perform even the most basic of Buddhist meditation practices. So they were taught how to breathe properly and specific exercises to strengthen them. These sets, modified from Indian yoga, were based on the movements of the 18 main animals in the -Chinese iconography (e.g. tiger, leopard, snake, dragon, crane, etc.), and were the beginning of Shaolin Kung Fu. Once they learned this, their ability to meditate improved.
The monks travelled throughout China teaching Buddhism. Since bandits during their journeys often attacked them, they incorporated fighting skills into their training. As their religion grew, so did their fighting skills.
People were impressed by the monks and asked to learn their skills, and soon developed their own variations of fighting systems. Some were based on animal movements, such as the Crane, Tiger, and Monkey systems, just to name a few.
While all this was happening in China, Japan was trying to expand, and the sword become their icon. Japan was a warring country. They conquered Okinawa where through trade with China some people had learned Chinese martial arts. The Japanese learned these arts and modified them to fit their own environment and problems. This new style eventually became known as Karate. There are many different forms of Karate, such as Go-Ju Ryu, Shotokan, Wado Ryu, and many others. Karate is best known for its powerful punches and kicks.
When Japan ruled Okinawa the Japanese outlawed all weapons. People developed techniques that used many farm implements as tools for self-defence.
The Nunchaku (agricultural flail) this is two sticks connected by a string; the Tonfa, which many police departments use, also known as PR 24 Baton were among these.
Soon Karate arts were brought to Japan. The man given credit for that is Gichin Funakoshi. He developed Shotokan from several older forms of Okinawan Karate, and this system became part of the school curriculum in many areas. This was fairly recent, since he died in 1922.
While all this was going on, Japan had developed its own system of fighting, which they constantly improved during their civil wars. One such system is Daito-Ryu, which is the basis for many different arts, including Nihon Goshin Aikido.