This is a really good question and like most things in the movie business, the answer is really situational; dependent on WHY those extra writers were brought in to work on a script. These are only some of the examples.
1) A producer (the money person) has a story idea - but he/she is not a writer. So one writer, or several, are approached to create the screenplay. In the film credits this is usually phrased by STORY BY: xyz person SCREENPLAY BY: abc person/s.
2) A writer (you or me) creates a 'spec' or 'indie' script... one that has no actor or directors attached (the talent); but is created merely because the writer thought it was a good idea and thought the screenplay might sell. A producer (the money guy) or name director reads the script and really likes it EXCEPT for xyz... whatever reason. So they contract with the writer (through an agent and or lawyer) to buy, or at least option, the script. The initial writer agrees to the changes and the deal is a 'go'.
But in the process of trying to find the perfect director or name actor to sign onto the script - more changes are suggested to the writer. This time the writer decides the changes will really compromise her initial concept/theme/idea. For whatever reason, she refuses to make the changes the producer suggests. Let's be clear, once you sign a contract - the producer owns your script. He is legally able to find another writer to MAKE the story changes no matter what you think. Hence the 2nd name in the credits.
3) Or, on the road to finding the perfect blend of story/producer/director and actor - the script goes through many, many rewrites; ideally these are done by the original writer. But sometimes another writer, who has an established expertise, (dialogue for instance) will be called in to FRESHEN the script or give it a skew to a particular actor's talents. (think Schwartzeneger's 'Ill be BACK' line). Often these collaborations between writers are quite amiable... most writers are fully aware of the limits to the skills they bring to the table.
There are many, many other situations where a whole stable of writers take turns polishing a script for various complex reasons. Film making is a collaborative art, and your original screenplay is often only a springboard for other creative talents that will combine to bring your script to the big screen. You really need to be able to stand back and let that happen. AND never sign a deal or contract without the advice of a really good agent or film lawyer who will protect your rights in the eventuality of any of the above creative writing situations.
I hope this helps. And good luck in your writing. I'd love to read your work!