Let the polygon have $n$ sides. The sum of the interior angles of an $n$-gon is $180(n-2)$ degrees, and the sum of the exterior angles is always 360 degrees. Therefore, we have the equation:
$$180(n-2) = 3 \cdot 360$$
Simplifying, we get:
$$n-2 = 6$$
$$n = \boxed{8}$$
So the polygon has 8 sides