Nobody knows who composed the Alpamysh, or exactly when, but they probably first sang the Alpamysh in Central Asia between 600 and 800 AD, about the same time as Beowulf. The Alpamysh was passed down as a Turkish story sung out loud for hundreds of years. Whoever wrote the Book of Dede Korkut, about 1400 AD, included the Alpamysh as one of the stories in that book.
The story has two parts. In the first part, the hero Alpamysh wants to marry his girlfriend, Barchin. They've been engaged since they were little children. But their fathers had a fight, and Barchin's father Baysari moved away to Mongolia, where the Kalmyks lived. When Barchin grew up, the Shah of Kalmyk, Taycha Khan, wanted to marry her, but Barchin still loved Alpamysh. So Barchin announced that she would marry whoever won four contests for her hand: a horse race, two archery contests, and wrestling.
Barchin sent several messengers to Alpamysh to make sure he would come compete in the contests. Sure enough, Alpamysh did come. With the help of his friend Karajan, Alpamysh won the contest, even though Taycha Khan cheated by tying Alpamysh in ropes and hurting Alpamysh's horse by pounding sharp nails into his horse-shoes (compare this to the Greek story of Pelops or Atalanta). So Barchin and Alpamysh got married, and they went back to Kongrat where they were from, but Barchin's father Baysari stayed in Kalmyk country.
In the second part of the story, Alpamysh heard that the Kalmyks had been hurting Barchin's father Baysari. So Alpamysh went back to Kalmyk country to save Baysari. But the Kalmyks captured Alpamysh and kept him in prison for seven years. The Khan's daughter (the princess) visited him and fell in love with him and helped him escape from the prison (like the Greek princess Ariadne).
When Alpamysh got home to Kongrat, he found that things were all wrong at home. Alpamysh's younger brother Ultantaz had made himself king, and he disrespected Alpamysh's old father and his young son Yadgar, and forced Barchin to marry him. Alpamysh cleverly changed clothes with his old shepherd Kultay, came to the wedding in disguise, freed his wife Barchin and killed Ultantaz. (Compare the end of the Greek story of Odysseus). Baysari then came home, and Alpamysh and Barchin lived happily ever after.