Typically, the phrase ma shaa' Allah (Arabic: ما شاء الله) is used when one sees something that one appreciates.
In Al-Kahf chapter in the Qur'an, we come across:
وَلَوْلَا إِذْ دَخَلْتَ جَنَّتَكَ قُلْتَ مَا شَاءَ اللَّهُ لَا قُوَّةَ إِلَّا بِاللَّهِ ۚ إِن تَرَنِ أَنَا أَقَلَّ مِنكَ مَالًا وَوَلَدًا
And why did you, when you entered your garden, not say, 'What Allah willed [has occurred]; there is no power except in Allah '? Although you see me less than you in wealth and children.
— Qur'an 18:39
In this story, Allah tells us about a man that He had bestowed upon him two gardens of grapevines, surrounded by palm trees, and in between them fields of crops. This man, while conversing with his friend, boasted that he had greater wealth and more children than his friend. The man claimed that his gardens would never perish,. He further denied there was a Judgment Day, and even if there were one, Allah would give him even a better reward then. His friend responded by questioning his belief ("Have you disbelieved in He who created you from dust and then from a sperm-drop and then proportioned you as a man?"), then told him the verse above that the rich man should have said as a form of acknowledging Allah's blessings, and attributing them to Him alone. We know from the verses after that the rich man later lost both gardens.
In Musnad Ahmad (Arabic: مسند أحمد), and in Majma' Al Zawa'id (Arabic: مجمع الزاوئد ومنبع الفوائد) by Ali ibn Abu-Bakr Al-Haythami:
عن سهل بن حنيف أن النبي ﷺ قال: هلا إذا رأيت ما يعجبك بركت
— NOTE: My own translation, so treat with care:
Narrated through Sahl ibn Hunaif that the Prophet ﷺ said: "Would you not, when you see what you like, offer blessings?"
— Mujama' Al Zawa'id 8426
Sahl ibn Hunaif, in this hadith, was riding with the Prophet ﷺ and other companions toward Mecca. When they reached Al-Kharrar (a place near Al-Juhfah), Sahl ibn Hunaif performed ghusl. Sahl had a fair complexion, a fit body, and a healthy skin. 'Amer ibn Rabi'a siad that he had never seen anyone with a more perfect skin. Sahl fainted then. The companions rushed to the Prophet ﷺ and told him the story, so the Prophet ﷺ said the above quote.
Scholars have concluded, based on the verse and the hadith above as well as others, that when one sees something that one likes and one owns to say ma shaa' Allah wa la quwwata illa bi Allah (Arabic: ما شاء الله لا قوة إلا بالله); and when one sees something that one likes but is not one's to say ma shaa' Allah, tabarak Allah (Arabic: ما شاء الله تبارك الله).
The exact words, of course, predate the Prophet ﷺ, so is their use in the contexts above.
NOTE: A comment on the YouTube video, it is just a list of assumptions from a Hindu perspective as it seems, and an attempt to connect the words to Sanskrit one way or the other. Unfounded, generally speaking.