Hint (Re-framing question for clarification): What you need to prove is that, given any two subgroups $$H_1 \leq G\;\;\text{and}\;\;H_2\leq G\;\;\text{with}\;\;H_1\neq H2\;\;\text{ and with}\;\;\gcd(|H_1|,|H_2|)=1$$ $\quad \implies $ that one $H_i$ must be the trivial group, and the other "subgroup" $H_j = G$, since there can then be only two numbers dividing the order of $G$: one of order $1$, the other of order $|G|$, and hence, $G$ must be cyclic.
You can do this all with the Theorem of Lagrange, but you really only need to note that the order of any subgroup of $G$ must be coprime to $1$, the order of $\{e\}$, i.e. since we have $\{e\} \leq G$, it must follow for any subgroup $H$ of $G$, $\gcd(|\{e\}|, |H|) = 1$.
Note: the italicized qualification in the first sentence is crucial if the statement is to be true; please see @DonAntonio's comment below the question.
Let me also offer some clarification with respect to your thoughts:
"I know from Lagrange that the order divides $|H_1|$ and $|H_2|$ but if so then the order of $G$ divides two numbers then it's not a prime number."
From the Theorem of Lagrange, if $G$ is a finite group, then the order of its subgroups divides the order of $G$: so if $H_1 \leq G$ and $H_2 \leq G$, then the order of $H_1$ divides the order of $G$, and the order of $H_2$ divides the order of $G$. $|G|$ does NOT divide the order of any of its subgroups other that of itself. $1$ divides the order of any group, including a group of prime order $p$. And prime $p$ divides the order of a group of order prime $p$. And a prime number, by definition, is not divisible by any numbers other than $1$ and $p$.