Your questions depends on who you ask.
Sufism is the "Western" name for this science of the heart. Within Sunni Islam this science is called tasawwuf. The Muslim putting in into practice is called a Sufi. Just as in the early history of Islam sciences such as Islamic law developed (fiqh), Islamic theologic reasoning (ilm al-kalam) and for example Quran interpration (tafsir) developed, so did tasawwuf or known as Sufism. Where the others sciences are about the outer aspects of the religion Sufism is about the essence of Islam and personal relationship of a Muslim with God.
In Sunni Islam it has always been explained as having a base in a authentic saying of Muhammad where Gabriel asked him what Islam was and the last, perfect, stage of it was: "worshipping God as if you see Him, and if you do not knowing that He sees you". This stage is called ihsan, which means something such as excellence. So this is the goal of the Sufi's, to achieve this state. Many times you will come across explanations of subjugating the "ego"/desire which stands as a barrier between human beings relation with God and to fully submit to Him, as can be read in poetry written by Sufi's for example. One way of doing that is remembering God by heart and in all parts of life, of which some Sufi's use methods in gatherings and/or if your alone.
Famous Islamic universities such Al Azhar in Cairo (most renowned Sunni university throughout history), Al-Qarawiyin in Fes or Zaytuna in Tunis all teach, and teached throughout their history, Sufism as a legitimate science within orthodox (sunni) Islam. Though there might be differences of opinion or criticism about certain methods used (to achieve this excellence in worshipping) and what is preferred and/or not allowed by Islamic law when related to worshipping God.
PS: This is the Sufism as can be found in orthodox Sunni Islam and is still present in many Muslim countries (the majority have a huge history when it comes to Sufism and the spread of Islam for example).