How can I set the output file name?

You can use option --job-name=NAME to set the name of the output file.

For example, you would run

pdflatex --job-name=dog cat.tex

to create the PDF file dog.pdf (instead of cat.pdf).