In Surah Yousuf, it’s written that 11 stars and sun and the moon will do sajda infront of Prophet Yousuf. Why did Allah do this because we all do sajda to one and only Allah. What is the reason behind this sajda and the main thing is that the sun was our prophet Yaqub, why did he do sajda?

It is a metaphor to show the greatness of Yusuf and the greatness of his father, mother and brothers as well.