Great question!!! I like the fact that people are getting more comfortable with asking anime based questions on musing.
The difference between them lies in the origin of each one. Animes are mainly asian animations, usually Japanese, which like marvel and DC cartoons are based on Japanese comics or "mangas" as they are called. Mangas differ from comics in the sense that they are actually black and white and aren't coloured at all. They are also usually shorter than comics and come out more frequently. Some animes may be based on manhuas which are also Japanese comics, but are in full colour.
The defining factor of animes is that they follow what happens in their mangas to the letter, except for the addition of some filler episodes and a slight change in the story if the show is being cancelled, they mostly serve as an on-screen re-enactment of what we see in the mangas or manhuas.
Cartoons on the other are shows which usually have no direct origin to any comic book or manga and when they do, they don't follow it the same way animes do. Even shows like Iron man, avengers, Spiderman and so on which are based on already existing comics, don't actually follow the storylines of these comics because there are so many different versions, at best they pick a single storyline and augment it a bit. Most of the time, fresh storylines are created and presented on TV which have nothing to do with the comics.
The creative direction of a cartoon is dependent on the writers but that of a manga is purely dependent on the manga, there's no way around it.