You cannot charge them rent for an illegal apartment. PERIOD They owe you nothing, not now nor from the date they moved in.. Be grateful that they haven't sued for all back rent, which they might still do.
You must get rid of them but I am not sure of the mechanics.
Tell the tenants to move (on paper) becasue they are living in all illegal apartment.
If they don't go, perhaps call the DOB and tell them you want to get rid of tenants living illegally in your basement. Perhaps some landlords here who have experience with illegal apartments
can help more in getting rid of your "tenants."
I am pretty sure the City can evict them quickly if the place is unsafe for human habitation.
When they are gone, pull out the stove, take out the door (you can leave a slop sink) and DON'T rent the place again. Maybe put in washers and dryers for your tenants?