Tasawwuf is a branch of Islamic knowledge which focuses on the spiritual development of the Muslim.
Allahﷻsent His final messenger, Prophet Muhammadﷺ, as a source of knowledge for the entire ummah. Heﷺwas the fountain of Quran, Hadith, tafsir, rhetoric, fiqh, and so on. After the Prophetﷺ, the scholars of this ummah carried and propagated each of these branches of knowledge. Because no one person can attain the perfection of the Prophetﷺ, who single handedly assumed all of these roles, various branches of the Islamic sciences developed. For example, Imam Abu Hanifah preserved the science of fiqh and after him thousands of scholars continued in his footsteps. Hence these scholars preserved the fiqh of the Prophetﷺ. Similarly Imam Bukhari and the other famous scholars of Hadith, preserved the words of the Prophetﷺ. The scholars of tajweed preserved the recitation of the Prophetﷺ. And, the scholars of Arabic grammar preserved the language of the Prophetﷺ.
Along these lines, the Prophetﷺwas the model of spirituality for the world. His God-consciousness, deep spirituality, acts of worship, and love for Allahﷻwere preserved and propagated by an Islamic science called Tasawwuf. The aim of the scholars of this science was purification of the heart, and development of consciousness of Allahﷻthrough submission to the shariah and sunnah.