Lung cancer grows disproportionately, and when it is near to certain nerves, it starts putting pressure upon them. There’s a nerve called recurrent laryngeal nerve, which runs down into the abdomen and goes up again to end up in the larynx (where we have the voice box). When this nerve is affected by the tumour, it will cause paralysis of various muscles in the larynx that are needed to produce your voice. Since you will still have the other nerve intact, you will be able to speak, but your voice will change to a hoarse tone.
There are plenty of reasons why people get a hoarse voice, and the most common is an inflammation in the larynx caused by infections. Thus, do not panic if you have this symptom and ask your doctor about it to investigate your case further.