During the Dark Ages, like most places in Europe, Poland was ruled by a lot of small princes and dukes, and none of them had very much power. Most of the people who lived in Poland were Slavs, but each little group of Slavs had its own leader. During the 800s AD, the Slavs had been busy fighting off the Holy Roman Emperors, but during the 900s there weren't any Holy Roman Emperors and Poland had been left pretty much alone. But in 962 AD, Otto I became the new Holy Roman Emperor and began to expand his empire by attacking his eastern neighbors. Duke Mieszko, a Slavic leader, decided he had better make all of Poland into one country that could defend itself against Otto's armies. Duke Mieszko kept Otto from making his attack a religious crusade by converting himself and his people to Christianity in 966 AD. Duke Mieszko lived a long time, and by the time he died in 992, he had made Poland one of the strongest countries in Europe.
When Mieszko died, his son Boleslaw became the first King of Poland. Boleslaw was a strong ruler and general like his father, and he also ruled a long time, and by the time King Boleslaw died he had conquered a large empire extending all the way to Kiev in the east and nearly to Berlin in the west. Boleslaw named the country after his own people, the Polans. Even though Boleslaw was a Christian like his father, he married four women at the same time. Boleslaw died in 1025 AD, when he was about sixty years old.
But when Boleslaw died, his enemies saw an opportunity to attack before Boleslaw's son, King Mieszko II, could get his feet under him. In 1031 Mieszko II lost a big battle where the Holy Roman Emperor Conrad II and the prince of Kiev, Jaroslaw, ganged up on him, and he lost a lot of land. But Mieszko II's son, Casimir the Restorer, and his grandson, Boleslaw II, were better generals and built up Poland's strength again. By making alliances with the Pope in Italy, Boleslaw II was able to successfully fight the Holy Roman Emperor, Heinrich IV, while his successor Boleslaw III was able to fight Heinrich V as well.
But in 1138, Boleslaw III's five sons split Poland up among themselves, and then there were a lot of small wars among the five dukes, the bishops of Poland, and the other rich men and women of the kingdom. These rich men and women got to be powerful enough that they were able, in 1228, to force Duke Wladyslaw III to sign the Acts of Cienia, which, like England's Magna Carta of 1215 and Hungary's Golden Bull of 1222, created a written law for Poland that even the dukes had to obey, so the dukes couldn't just do whatever they wanted anymore. But without a united kingdom, Poland couldn't defend itself against the attacks of the Holy Roman Emperor.
In 1241, 1259, and 1287, the Mongols invaded Poland and made it part of the Mongol Empire. But when the bubonic plague struck Central Asia in the early 1300s, the Mongol Empire collapsed. After this Poland regained its independence. In 1320, Wladyslaw I managed to reunite Poland and make himself king. Soon after that, in 1333, Wladyslaw's son Casimir III began to conquer the land to their East - Lithuania. While in most of Europe millions of people were dying of the plague, hardly anyone died in Poland, so this was a good time for Poland. Poland was also enriched both in money and in brain-power by welcoming thousands of Jews who were being persecuted in Western Europe at this time, and who now immigrated to Poland. The Pope complained about this kind treatment of the Jews, but the Polish king and the Polish church insisted on welcoming the Jews to Poland. Casimir lived a long time, but he had no sons, so when he died in 1370 AD he left Poland to his sister Elizabeth. When Elizabeth died in 1380, her son Louis of Hungary took over control of Poland for four years, but when Louis died in 1382, his daughter Jadwiga (Elizabeth's granddaughter) became Queen of Poland.