Self-destruct is a system that automatically launches explosive charges and uses them to destroy the ship. It is only functional while in space.
This is not a system typically used, but can occasionally be the only way to get yourself out a tricky situation. (Note: If you are new to the game and feel yourself to be stuck, there are probably options you aren't aware of. Ask others for help first! You can be sure you're not the first to get yourself into that situation.)
The command to begin self-destruct is simply SELF-DESTRUCT (hyphen included). If you wish to abort the self-destruct process once it has begun, type ABORT.
You may be wondering how you can prevent others from self-destructing your ship when you're in the head or some such. You can set an authorization code with the AUTH command! Remember your auth code, because you will need to enter it if you ever wish to self-destruct. Each ship maintains its own separate auth code, so don't forget to set it on new purchases!
Note, finally, that you will not receive an insurance payment if you self-destruct a ship.