Material world as we see, and are being part of it, is evolved out of the mula Prakriti. All matter of the world have three basic properties i.e. Sattva, rajas, tamas. Transformation of the universe is not possible without these three properties. These properties are confined in mula prakriti in the state of balance in an unmanifest form. The शून्य स्थिति. When the equilibrium is lost, manifested world emerges.
In this process of becoming manifest, mula prakriti creates Mahat or Buddhi. Then emerges Ego. This is followed by creation of Manas and set of Indriya (mind and senses).
As per Sankhya philosophy, senses are formed from the Sattva part of ego, with the help of Rajas. The तन्मात्रा(s) are formed from Tamas, with the help of rajas.
And from these तन्मात्रा(s), panch-mahabhuta(s) emerges.