There is no general method, but here are suggestions in two cases: $\mathbf Z[x]$ and $\mathbf Z[\sqrt{d}]$.
Let $I$ be an ideal in $\mathbf Z[x]$. Every ideal in $\mathbf Z[x]$ is finitely generated (and your two examples are even explicitly defined with two generators each), so we can write $I = (f_1,\ldots,f_r)$.
Let $d$ be the gcd of $f_1,\ldots,f_r$ in $\mathbf Z[x]$, which could be computed using irreducible factorizations of the $f_i$'s since $\mathbf Z[x]$ has unique factorization. This gcd is determined up to sign.
Claim: if $I$ is principal then $d$ must be a generator of $I$.
To prove the claim; suppose $I = (g)$. Then from $f_i \in I$ we have $f_i \in (g)$, so $g \mid f_i$ for all $i$. Thus $g \mid d$ by properties of unique factorization domains.
Since $g \in I = (f_1,\ldots,f_r)$, we have $g = f_1h_1+\cdots+f_rh_r$ for some $h_i$ in $\mathbf Z[x]$. Then $d$ dividing each $f_i$ implies $d \mid g$. That together with $g \mid d$ tells us $g = \pm d$, so $I = (g) = (d)$. This concludes the proof of the claim.
Your two examples are $(f_1(x),f_2(x))$ in $\mathbf Z[x]$ where $f_1(x)$ and $f_2(x)$ are relatively prime in $\mathbf Z[x]$. Therefore $\gcd(f_1(x),f_2(x)) = 1$ in $\mathbf Z[x]$. So if the ideal $(f_1(x),f_2(x))$ in $\mathbf Z[x]$ is principal then it must be $(1)$. Now it remains to check that $1 \not\in (f_1(x),f_2(x))$ in $\mathbf Z[x]$ in your two examples.
While ideals in $\mathbf Z[x]$ are not always principal, ideals in $\mathbf Q[x]$ are all principal and we can extend ideals in $\mathbf Z[x]$ to ideals in $\mathbf Q[x]$. When $A$ is a ring contained in a ring $B$ (like $\mathbf Z$ contained in $\mathbf Q$) each ideal $I$ in $A$ has an extension $IB$ to an ideal in $B$ that is defined to be the smallest ideal in $B$ containing $I$. Check
(i) $IB$ consists of all sums $\sum_{k=1}^n i_kb_k$ where $n \geq 1$, $i_k \in I$, and $b_k \in B$,
(ii) when $I = aA$ we have $IB = aB$,
(iii) when $I = a_1A + \cdots + a_mA$, we have $IB = a_1B + \cdots + a_mB$.
We can abbreviate (ii) and (iii) to $I = (a) \Rightarrow IB = (a)$ and $I = (a_1,\ldots,a_m) \Rightarrow IB = (a_1,\ldots,a_m)$, where you're expected to realize that the parentheses in the descriptions of $IB$ mean ideals generated in $B$ rather than in $A$.
Example. If $I = (2,x)$ in $\mathbf Z[x]$, then $I \not= \mathbf Z[x]$ since $1 \not\in I$, as all constants in $I$ are even, but $I\mathbf Q[x] = (2,x) = \mathbf Q[x]$ since $2$ is a unit in $\mathbf Q[x]$.
Starting with an ideal $I = (f_1(x),\ldots,f_r(x))$ in $\mathbf Z[x]$, its extended ideal $I\mathbf Q[x]$ must be principal because $\mathbf Q[x]$ is a PID. Then $I = (f(x))$ for some $f(x)$ in $\mathbf Q[x]$. By (iii) above, $I\mathbf Q[x] = (f_1,\ldots,f_r)\mathbf Q[x]$, so by the same argument used in $\mathbf Z[x]$ we know $f$ has to be the gcd of the $f_i$'s in $\mathbf Q[x]$, which is determined up to a nonzero constant multiple. Every nonzero polynomial in $\mathbf Q[x]$ has a constant multiple that is a primitive polynomial in $\mathbf Z[x]$, so we can take $f$ to be the gcd of $f_1,\ldots,f_r$ in $\mathbf Q[x]$ that's primitive in $\mathbf Z[x]$.
Suppose $I = (f_1,\ldots,f_r)$ is principal in $\mathbf Z[x]$, so $I = d\mathbf Z[x]$ where $d$ is the $\mathbf Z[x]$-gcd of $f_1,\ldots,f_r$. Then $(d) = (f)$ as ideals in $\mathbf Q[x]$, so
$d = sf$ where $s \in \mathbf Q^\times$. Write $s$ in reduced form as $m/n$. Then $nd = mf$, an equation in $\mathbf Z[x]$. Compute the content (gcd of coefficients) of both sides:
$n\,{\rm cont}(d) = m\,{\rm cont}(f) = m$ in $\mathbf Z$ since $f$ is primitive, so ${\rm cont}(d) = m/n = s$.
Thus $d = sf = {\rm cont}(d)f$. If some $f_i$ is primitive then $d$, a factor of $f_i$ in $\mathbf Z[x]$, is also primitive, so ${\rm cont}(d) = 1$ and thus $d = f$: if $I$ is principal and some $f_i$ is primitive then $I$ must be generated as an ideal in $\mathbf Z[x]$ by the $\mathbf Q[x]$-gcd of the $f_i$'s that is scaled to be primitive in $\mathbf Z[x]$.
Everything I wrote about $\mathbf Z[x]$ carries over to $R[x]$ when $R$ has unique factorization.
Now let's look at a different family of rings: $\mathbf Z[\sqrt{d}]$ where $d$ is an integer that is not a perfect square.
Two key facts: (i) every nonzero ideal $I$ in $\mathbf Z[\sqrt{d}]$ has finite index (meaning the quotient ring $\mathbf Z[x]/I$ is finite) and (ii) each nonzero principal ideal $(a+b\sqrt{d})$, where $a$ and $b$ are integers, has index $|a^2 - db^2|$ in $\mathbf Z[x]$.
Here is how you can prove (i): pick a nonzero element $a+b\sqrt{d}$ in $I$. Then its norm $n := (a+b\sqrt{d})(a-b\sqrt{d})$ is a nonzero integer that's also in $I$ and $(n) \subset I \subset \mathbf Z[\sqrt{d}]$, so it suffices to prove principal ideals $(n)$ with nonzero $n$ in $\mathbf Z$ have finite index in $\mathbf Z[\sqrt{d}]$ and that follows from writing $(n) = \mathbf Z{n} + \mathbf Z{n}\sqrt{d}$, since it implies $\mathbf Z[\sqrt{d}]/(n) \cong (\mathbf Z/n\mathbf Z)^2$ as additive groups (not as rings!) and thus $(n)$ has index $n^2$ in $\mathbf Z[\sqrt{d}]$.
Here is how you can prove (ii): when $I = (a+b\sqrt{d})$, set $n = (a+b\sqrt{d})(a-b\sqrt{d})$. Then $(n) \subset I \subset \mathbf Z[\sqrt{d}]$, so
$$
n^2 = [\mathbf Z[\sqrt{d}]:(n)] = [\mathbf Z[\sqrt{d}]:I][I:(n)],
$$
where $[I:(n)]$ is the cardinality of the quotient group $I/(n) = (a+b\sqrt{d})/((a+b\sqrt{d})(a-b\sqrt{d}))$. In any integral domain $R$, with nonzero elements $\alpha$ and $\beta$, $\alpha R/(\alpha\beta)R \cong R/\beta R$ as additive groups, so $I/(n) \cong \mathbf Z[\sqrt{d}]/(a-b\sqrt{d})$. The conjugation mapping $x+y\sqrt{d} \mapsto x-y\sqrt{d}$ is a ring automorphism of $\mathbf Z[\sqrt{d}]$ that sends the ideal $(a+b\sqrt{d})$ to the ideal $(a-b\sqrt{d})$, so conjugation induces a ring isomorphism from $\mathbf Z[\sqrt{d}]/(a+b\sqrt{d})$ to $\mathbf Z[\sqrt{d}]/(a-b\sqrt{d})$. Thus $[\mathbf Z[\sqrt{d}]:(a-b\sqrt{d})] = [\mathbf Z[\sqrt{d}]:(a+b\sqrt{d})]$, so $[I:(n)] = [\mathbf Z[\sqrt{d}]:(a-b\sqrt{d})] = [\mathbf Z[\sqrt{d}]:(a+b\sqrt{d})]$. Hence
$$
n^2 = [\mathbf Z[\sqrt{d}]:(n)] = [\mathbf Z[\sqrt{d}]:I][I:(n)] = [\mathbf Z[\sqrt{d}]:I]^2.
$$
Now take square roots to get $[\mathbf Z[\sqrt{d}]:I] = |n|$.
Back to the general setting, when $I$ is a nonzero ideal in $\mathbf Z[\sqrt{d}]$ with index $n$, in order that $I$ be principal we have to be able to solve the equation $x^2 - dy^2 = n$ or $x^2 - dy^2 = -n$ in integers $x$ and $y$. So if those two equations have no integral solutions, then $I$ is not principal.
Example. In $\mathbf Z[\sqrt{5}]$ the ideal $I = (2,1+\sqrt{5})$ turns out to have index $2$, but the equations $x^2 - 5y^2 = \pm 2$ have no integral solutions because they have no solutions mod $5$. Thus the ideal $(2,1+\sqrt{5})$ in $\mathbf Z[\sqrt{5}]$ is nonprincipal.
Theorem 3.3 and examples in Section 4 here show you how to determine whether $x^2 - dy^2 = \pm n$ has an integral solution without having to rely on the modular arithmetic trick above.
Best Answer
$3+2i=13-2(5-i)$, implies that $3+2i\in (13,5-i)$. This implies that $(3+2i)\subset (13,5-i)$. Since $13=(3-2i)(3+2i)$ and $5-i=(1-i)(3+2i)$, you deduce that $(13,5-i)\subset (3+2i)$.