I studied in Denmark for 6 months with a Danish resident permit. Upon completion of my program, I couldn't renew my permit. Before the expiration date, I then travelled to Poland to start another program which I applied for when I was in Denmark. But, unfortunately, I could not enroll in the program in Poland, and my Danish residence permit expired while I was Poland. What are my chances of going back to Denmark after I return to my home country from Poland?
If you are currently in Poland without a valid visa, and if you would need a visa for Poland, then you are overstaying in the Schengen area right now.
While we don't know all the details of your case, any overstay in the Schengen area will complicate future Schengen visa application. It won't be impossible, but it will be much harder.