We are given :
$ax\equiv b \pmod{m}$
$cx \equiv d \pmod{n}$
Let's denote $a^{-1}$ to mean the integer, should it exist, such that $aa^{-1}\equiv1 \pmod {m}$. Similarly, $cc^{-1}\equiv 1 \pmod{n}$. Note these inverses don't always exist.
$aa^{-1}\equiv 1 \pmod m\implies mp=aa^{-1}-1\implies aa^{-1}-mp=1$
So we only have a inverse if $gcd(a,m)=1$. By similar argument we also need $gcd(c,n)=1$.
Given those equations are satisfied, $a^{-1}$ and $b^{-1}$ can be found by Bezout's Identity or Euclid's GCD Algorithm.
Rewrite the congruences as:
$x\equiv ba^{-1} \pmod{m}$
$x \equiv dc^{-1} \pmod {n}$
From the first equation we have $x-ba^{-1}=mp\implies x=mp+ba^{-1}$ for some $p$. Place that value of $x$ into the second congruence:
$x \equiv dc^{-1} \pmod {n}\implies mp+ba^{-1}-dc^{-1}=nq$ for some $q$.
$\implies ba^{-1}-dc^{-1}=nq-mp$
This equation has solutions iff $gcd (m,n)|(ba^{-1}-dc^{-1})$.
Using Bezout's Identity again, find $p'$, $q'$ so that $nq'-mp'=gcd(m,n)$.
Then $p=p'(ba^{-1}-dc^{-1})/gcd(m,n)$. There is a similar expression for $q$.
Plug these values into the expression for $x$, reckoning $\pmod{lcm(m,n)}$ and one finds the desired solutions for $x$.
This is essentially a rehas of The Chinese Remainder Theorem.