Did modern alligators and caimans come from prehistoric crocodiles?
This is the phylogeny of the Crocodilia, as best as we currently know it:

The order Crocodilia is a monophyletic group including all living crocodile and alligator species. That means that all of these species share a common ancestor and all descendants of that ancestor are part of Crocodilia. 

Within the Brevirostres, three superfamilies exist - the now extinct Borealosuchus, the Gavialoidea, within only two species not already extinct, and the Brevirostres. 

The Brevirostres are the monophyletic group containing the crocodiles and alligators (that includes the caimans). 


  Did alligators come from crocodiles when the crocs swam into freshwater areas?


That very much depends on what you mean with "crocodile". If it's Crocodylidae, then no, these are sister groups. If it's only the true crocodiles (Crocodylids), no, those evolved after the split with alligators. If it's Crocodilia, then yes, alligators evolved from crocodiles. 


  And since the alligators and caimans are 2 groups in alligatoridae did they have a common ancestor?


Yes. However, saying that is rather boring - all life has a common ancestor. If you mean whether they have a common ancestor and all descendants of that ancestor are either alligators or caiman, then yes. 

Additional source: Crocodilian phylogeny inferred from twelve mitochondrial protein-coding genes, with new complete mitochondrial genomic sequences for Crocodylus acutus and Crocodylus novaeguineae