It's illegal by US law on the grounds that you're a US citizen still. If you were to...
...Go to a US consulate in a country that you are legally able to reside in, renounce your US citizenship, and have your declaration of renunciation approved...
...then you could legally go to Cuba.