Who decides who gets credit for writing a movie?

When a movie is complete, the producer submits a list of final credits to the WGA, and gives a copy of the final script to all writes involved. If any writers disagree with these credits, he can file for arbitration. (Arbitration is automatically triggered if the director or any producers are credited in any writing capacity.)

In arbitration, WGA members review all drafts of the script, and determine credits based on a formula. The basics for “screenplay” credit, from the WGA’s screen credits policy:

Any writer whose work represents a contribution of more than 33% of a screenplay shall be entitled to screenplay credit, except where the screenplay is an original screenplay. In the case of an original screenplay, any subsequent writer or writing team must contribute 50% to the final screenplay.