No one knows exactly when it started, tho definitely it occurred in Olympia, in the Southwestern part of Greece.
Legend has it that Heracles with his four brothers came to Olympia and ran a "foot race" which was the 1st Ancient Olympic Game. Heracles was the 1st Champion. Possibly in 776 B.C.
From then on up to 393 A.D. The Ancient Olympic Games were held every 4 years between representatives from Grecian city states.
It was not purely athletic, but as well as a religious festival and cultural contests. The athletes had to undergo a 10-month heavy physical conditioning and a ritual purification of their spirits before being allowed to compete. When competitions were held, wars were postponed unlike in Modern Olympics where the Olympics were postponed when war erupts. Each ancient competition lasted 5 days.
The 1st 13 Ancient Olympics had only one event, that of a "single foot race" of 200 yards. A "priest" stood at one end of the course holding a "sacred Olympic flame" while the runners raced towards the torch. The winner then is handed the torch and was privileged to light the main "Olympic Flame".
The Ancient Olympians did not receive medals as in the Modern Olympics. They received a wreath of wild olive as prize. Some became heroes in their own city-state and some of them honored with a statue.
In 708 BC, a 27-mile endurance race was added together with wrestling and pentathlon (consists of long jump, javelin throw, discus throw, and 1500 meter run). Boxing was introduced in 688 BC. While the 4-horse chariot race began in 680 BC.
At some point the athletes competed "in the nude" and were all males. The women were not even allowed to witness the events. It was only in the 6th Century when women were allowed their own Olympics called "Herea".
In the 4th Century AD when Greece became part of the Roman Empire, the Emperor Theodosius outlawed the Games and was never held for the next 1500 years, until 1896 when the Modern Olympics was organized by Count Pierre de Coubertin, a Frenchman educator who believed in the importance of physical education in addition to intellectual development.