Certified GKH Gardening Expert
It does look like black nightshade (Solanum nigrum). The nightshades contain glycoalkaloid compounds that can be toxic to humans and livestock if consumed. It also can harbor pests and diseases that can affect other crops growing.
It is related to the highly toxic deadly nightshade, Atropa belladonna.