I just took math final and one of the question was
Find $3^{43}\bmod{33}$.
So, I used Euler's function; $\phi(33)=20$.
$3^{20}\equiv 1\pmod{\!33}$
By using this fact, I got $27$.
One thing that I don't understand is that to use Euler's function to find mod, shouldn't we have $\gcd(3,33)=1$? Here $\gcd(3,33)=3\neq 1$, but it gave the right answer.
Yes, to use Euler's theorem, i.e., $a^{\phi(n)} \equiv 1\pmod{n}$, you need $\gcd(a,n)$ to be $1$. Hence, your method is incorrect, though your final answer is correct.
The right way to proceed is as follows.
We have $$3^{10} \equiv 1 \pmod{11} \implies 3^{43} \equiv 5 \pmod{11}$$ This means $$3^{43} \equiv 5,16,27\pmod{33}$$ Further, $3$ divides $3^{43}$. Hence, $$3^{43} \equiv 27\pmod{33}$$