All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad, sallallaahu 'alayhi wa sallam, is His slave and Messenger.
If you earned unlawful money through usury, gambling, or the like, then you were supposed to get rid of this money by spending it on different acts of goodness and things that benefit Muslims. You should not have used it in trade or any other business. If you used it in trade and made profits, then the profits of this trade are lawful, even though its source is unlawful money. However, you have to get rid of the amount of unlawful money.
Allah knows best.