If you enter the search term "How to find out what a carpet is made from" then you're likely to find references to 'burn tests'. Carpet burn tests involve taking a small sample of the carpet fibre, going outside, and holding it over a naked flame to observe whether it shrinks, melts, or burns, while noting the resulting smell.
Now there's a much simpler, safer, and more accurate method to determine the composition of carpets, using Sagitto's miniature NIR spectrometer. A method that will tell you the carpet's fibre composition within a few seconds, without damage to either the carpet or your lungs.