Find a surjection $(\mathbb Z/m)^\times\to (\mathbb Z/n)^\times$ Assume $n|m$ and suppose further that $m$ and $n$ have the same prime factors.

How can we construct a surjective map
$$(\mathbb Z/m)^\times\to (\mathbb Z/n)^\times$$
which preserves the group multiplication?

I tried the map $a+m\Bbb Z\mapsto a+n\Bbb Z$ but I can't prove that it's surjective. I don't know how to use the fact that $m$ and $n$ have the same prime factors.
Your map is fine. Here's a proof that may help you.

Suppose $a\not\in(\mathbb{Z}/n)^\times$ and $a\in(\mathbb{Z}/m)^\times$. Then $\exists b\in(\mathbb{Z}/m)^\times : a b \equiv 1 \mod{m}$.

It holds that $a\not\in(\mathbb{Z}/n)^\times$ so it does not have an inverse. Since $n$ divides $m$, $1 \mod{m} \equiv 1 \mod{n}$. But in that case $a b \equiv 1\mod{n}$. This is a contradiction.

Therefore, if $a\not\in(\mathbb{Z}/n)^\times$ then $a\not\in(\mathbb{Z}/m)^\times$.

Use the negation of that:
$$
¬ (a\not\in(\mathbb{Z}/n)^\times \Rightarrow a\not\in(\mathbb{Z}/m)^\times) \Leftrightarrow  (a\in(\mathbb{Z}/m)^\times \Rightarrow a\in(\mathbb{Z}/n)^\times)
$$

$a\in(\mathbb{Z}/m)^\times \Rightarrow a\in(\mathbb{Z}/n)^\times$ is the clue to what you want to prove.

This shows that your map is well-defined. Every element from $\mathbb{Z}/m^\times$ maps to an element from $\mathbb{Z}/n^\times$. The map is also a surjection because the image of every element is never empty.

I hope this helps :)
Suppose

$$m=\prod_{k=1}^s p_k^{a_k}\;,\;\;n=\prod_{k=1}^s p_k^{b_k}\;,\;1\le b_k\le a_k\;,\;\;p_k\;\;\text{primes}$$

From the above is clear now that if $\;x\le n\;$ , then $\;gcd(x,n)=1\iff gcd(x,m)=1\;$ and there you have your surjectivity proof.