The Guiding Principle
As mentioned by @M.M, a well-known principle from the principles of Islamic jurisprudence (Usool al-Fiqh) distinguishes between acts of worship ('Ibaadah), and acts that are from worldly matters which include things like eating, drinking, clothing, earning livelihood and financial transactions ('Aadaat - literally translated as "customs and habits", but really refers to worldly matters):
- The basic principle concerning acts of worship is prohibition unless proven otherwise
- The basic principle regarding worldly matters is permissibility unless proven otherwise
An alternative expression of the same concept:
- The original ruling regarding acts of worship is abstention/withholding (Tawqeef)
- The original ruling regarding worldly matters is permissibility
Explanation & Evidence
Restating the first point, if the action under scrutiny is considered to be from worship, it needs to have an established evidence for its permissibility in order for a person to perform it.
This article highlights the Hadeeth of 'A'ishah as a proof for this aspect of the principle, in which Muhammad ﷺ said:
من أحدث في أمرنا هذا ما ليس منه فهو رد
“He who innovates something in this matter of ours (i.e., Islam) that is not of it will have it rejected (by Allah).”
In contrast, the second point says that if the action under scrutiny is classified to be from the worldly matters, it is permissible by default unless there is a proof establishing its prohibition.
This principle is highlighted in the following Qur'anic verse, where all foods are permissible with a few noticeable exceptions (the list of prohibited foods is not exhaustive):
قُل لَّا أَجِدُ فِي مَا أُوحِيَ إِلَيَّ مُحَرَّمًا عَلَىٰ طَاعِمٍ يَطْعَمُهُ إِلَّا أَن يَكُونَ مَيْتَةً أَوْ دَمًا مَّسْفُوحًا أَوْ لَحْمَ خِنزِيرٍ فَإِنَّهُ رِجْسٌ أَوْ فِسْقًا أُهِلَّ لِغَيْرِ اللَّـهِ بِهِ فَمَنِ اضْطُرَّ غَيْرَ بَاغٍ وَلَا عَادٍ فَإِنَّ رَبَّكَ غَفُورٌ رَّحِيمٌ
Say (O Muhammad ﷺ): "I find not in that which has been inspired to me anything forbidden to be eaten by one who wishes to eat it, unless it be Maytah (a dead animal) or blood poured forth (by slaughtering or the like), or the flesh of swine (pork, etc.) for that surely is impure, or impious (unlawful) meat (of an animal) which is slaughtered as a sacrifice for others than Allah (or has been slaughtered for idols, etc., or on which Allah's Name has not been mentioned while slaughtering). But whosoever is forced by necessity without wilful disobedience, nor transgressing due limits, (for him) certainly, your Lord is Oft-Forgiving, Most Merciful."
Surah Al-An'aam, Verse 145
And this Hadeeth of 'Abdullah ibn 'Abbaas mentions the same verse:
قَالَ كَانَ أَهْلُ الْجَاهِلِيَّةِ يَأْكُلُونَ أَشْيَاءَ وَيَتْرُكُونَ أَشْيَاءَ تَقَذُّرًا فَبَعَثَ اللَّهُ تَعَالَى نَبِيَّهُ وَأَنْزَلَ كِتَابَهُ وَأَحَلَّ حَلاَلَهُ وَحَرَّمَ حَرَامَهُ فَمَا أَحَلَّ فَهُوَ حَلاَلٌ وَمَا حَرَّمَ فَهُوَ حَرَامٌ وَمَا سَكَتَ عَنْهُ فَهُوَ عَفْوٌ وَتَلاَ { قُلْ لاَ أَجِدُ فِيمَا أُوحِيَ إِلَىَّ مُحَرَّمًا } إِلَى آخِرِ الآيَةِ
The people of pre-Islamic times used to eat some things and leave others alone, considering them unclean. Then Allah sent His Prophet (ﷺ) and sent down His Book, marking some things lawful and others unlawful; so what He made lawful is lawful, what he made unlawful is unlawful, and what he said nothing about is allowable. And he recited: "Say: I find not in the message received by me by inspiration any (meat) forbidden to be eaten by one who wishes to eat it...." up to the end of the verse.
Sunan Abu Dawood, graded authentic by Ibn Katheer and others
What is expected of an individual in determining the legality of X
The principle mentioned above should serve as a starting point:
Is the action in question from the religious matters? If no authentic evidence is established for it, the action itself is impermissible.
Is the action in question from the worldly matters, such as eating, drinking and financial transactions? Is there any Shar'ee basis for objection to the matter? If no basis for its prevention is authentically established, the action itself is permissible.
If the individual is not at the level of a Mujtahid (one who can derive rulings based on Shar'ee texts), the matter should be referred to the scholars.
If the matter is still doubtful, it is safer to avoid the matter altogether in light of the Hadeeth of the Prophet ﷺ, reported on the authority of Nu'maan ibn Basheer:
إن الحلال بين، وإن الحرام بين، وبينهما مشتبهات لا يعلمهن كثير من الناس، فمن اتقى الشبهات، استبرأ لدينه وعرضه، ومن وقع فى الشبهات، وقع فى الحرام
What is lawful is clear and what is unlawful is clear, but between them are certain doubtful things which many people do not know. So he who guards against doubtful things keeps his religion and his honour blameless. But he who falls into doubtful things falls into that which is unlawful
Saheeh al-Bukhari & Saheeh Muslim