I have heard people saying subhanallah when they are surprised by something. Is this practice from the sunnah? If it is from the sunnah, then could you provide some evidence that would prove that it is from the sunnah?
Let us understand the meaning and intent behind using this word which will clarify your question. Let us focus on the first part of the word which comes from the root (س ب ح) which means to keep something afloat.
وَهُوَ الَّذِي خَلَقَ اللَّيْلَ وَالنَّهَارَ وَالشَّمْسَ وَالْقَمَرَ ۖ كُلٌّ فِي فَلَكٍ يَسْبَحُونَ
And He it is Who has created the night and the day, and the sun and the moon, each in an orbit floating. Quran 21:33
The concept of keeping something afloat is used in glorifying Allah is to separate and place the Creator above the creation and to realise the imperfection of the Creation while appreciating the absolute perfection of the Creator and negating defects attributed to the creator. The common translation that you see for subhanAllah is Glory be to Allah which might be correct to some extent but it is not the exact translation. The closest translation would "Allah is above all imperfection". This can be realised by looking at the verses of Quran. Allah has used the word subhanAllah to negate imperfection attributed to him. Here is one such example from Surah Zumar verse 4, where Allah says he is free from the human imperfection of having children.
لَّوْ أَرَادَ اللَّهُ أَن يَتَّخِذَ وَلَدًا لَّاصْطَفَىٰ مِمَّا يَخْلُقُ مَا يَشَاءُ ۚ سُبْحَانَهُ هُوَ اللَّهُ الْوَاحِدُ الْقَهَّارُ
Had Allâh willed to take a son (or offspring), He could have chosen whom He willed out of those whom He created. But glory be to Him! (He is above such things). He is Allâh, the One, the Irresistible. Quran 39:4
The word ‘tasbeeh’ means the act of saying subhanAllah just as tahmeed means the act of saying alhamdulillah and takbir means act of saying AllahuAkbar
When one does tasbeeh, they negate any flaw and affirm all perfection in Allah.
Hence somebody might be surprised when they see something extraordinarily beautiful and they might say subhanAllah, which basically means that, even though the creation is looking astonishing, it still has imperfection and the one who created has absolute perfection.
Hope this clarifies.
Assalamu Alaikum brother or sister, I think your question is answered here. Kindly refer to the following link.