As per your question, what I could figure the error is the name of html 'ID'. Check that ID for both the galleries is different.
If you have ID name of gallery one same as gallery two, it behaves particularly the way you have specified here. If so, change the gallery name of second carousel and create js function for second carousel in the javascript file. Hope this helps.