The one-sentence answer to this question is: use fpqc descent theory (and an "answer" which doesn't address the role of fpqc descent -- sometimes presented in the form of a reference to a paper of Beauville and Laszlo -- is missing the key technical issue in the rigorous proof when working with general $G$, as far as I know).

We make two "necessary" hypotheses (as noted in the comments to Sawin's answer) for our smooth connected affine $k$-group $G$: ${\rm{H}}^1(K,G) = 1$ for $K = k(X)$ and ${\rm{H}}^1(k',G) = 1$ for all finite extensions $k'/k$. For example, if $k$ is finite then this holds for any simply connected semisimple (connected) $G$ by the theorems of Harder and Lang respectively. If instead $k$ is algebraically closed of char. 0 then it holds for any $G$ by theorems of Tsen and Springer. If $k$ is algebraically closed of positive characteristic then it holds for any connected reductive $k$-group $G$, but Springer's theorem doesn't literally apply; see Remark 2(b) of the Drinfeld-Simpson paper mentioned in the comments to Sawin's answer.

We shall allow $X$ to be any 1-dimensional reduced and irreducible $k$-scheme of finite type, not assumed to be proper or even normal. This way we incorporate Chervov's observations about using singular curves to build in more level structure.

We construct the desired bijection as follows. Consider a left $G$-torsor $E \rightarrow X$ (local triviality equivalent for the fpqc and etale topologies due to the smoothness of $G$; the equivalence will be crucial later on and is false in general if we try using the Zariski topology, and officially we work with the etale topology in the definition as is traditionally done). Since ${\rm{H}}^1(K,G) = 1$, the generic fiber $E_{\eta}$ has a $K$-point and this spreads out over a dense open $U$ in $X$. Fix such a $U$ and trivialization $\xi \in E(U)$.

Let $X^0$ be the set of closed points of $X$. Consider the pullback of $E$ over the completion $O^{\wedge}_x$ at $x \in X^0$. This pullback is a smooth $O^{\wedge}_x$-scheme whose special fiber is a $G$-torsor over the finite extension $k(x)$ of $k$ and so has a $k(x)$-point due to the other vanishing hypothesis. By smoothness (!) of $G$ (and the henselian property of $O^{\wedge}_x$) this lifts to a point $\xi_x \in E(O^{\wedge}_x)$.

For each $x \in X^0$ consider the pullbacks of $\xi$ and $\xi_x$ over $U \times_X {\rm{Spec}}(O^{\wedge}_x) = {\rm{Spec}}(K_x)$ where $K_x$ is the total ring of fractions (product of finitely many fields) of the 1-dimensional reduced complete local ring $O^{\wedge}_x$. These two $K_x$-points of a common $G$-torsor are related through the action of a unique $g_x \in G(K_x)$; to be precise, $\xi = g_x \xi_x$ in $E(K_x)$. If $x \in U^0$ then clearly $g_x \in G(O^{\wedge}_x)$, so $(g_x) \in G(\mathbf{A}_X)$.

If we
change $\xi$ then we multiply every $g_x$ on the left by some common $g \in G(U)$, and if we change the various $\xi_x$'s then we multiply each $g_x$ on the right by an element of
$G(O^{\wedge}_x)$. Finally, taking into account that we may shrink $U$ (and thereby enlarge $X - U$), we obtain an element
$$(g_x) \in G(K)\backslash G(\mathbf{A}_X)/G(O^{\wedge})$$
(where $O^{\wedge} = \prod_{x \in X^0} O^{\wedge}_x$) that depends only on the isomorphism class of $E$ over $X$.

Our problem is to show that (i) this adelic double coset determines the isomorphism class of $E$ and (ii) all double cosets arise in this way.

The assertion (i) is proved as follows. Assume $E$ and $E'$ give rise to the same double coset, so for a Zariski-dense open $U$ in $X$ trivializing $E$ and $E'$ we have $(g'_x) = \gamma (g_x) h$ for some $\gamma \in G(K)$ and $h \in G(O^{\wedge})$ with $g'_x, g_x \in G(O^{\wedge}_x)$ for all closed points $x$ of $U$. By shrinking $U$ we may assume $\gamma \in G(U)$. We may replace $\xi_x$ with $h_x\xi_x$ for all $x \in X^0$ and replace $\xi$ with $\gamma \xi$ so that $g'_x = g_x$ for all $x$.
In other words, $E_U$ and $E'_U$ are each identified with the trivial $G_U$-torsor and has corresponding trivial $K_x$-fiber identified with the generic fiber of $G_{O^{\wedge}_x}$ via $g_x$-translation. Working one point of $X - U$ at a time, we just have to check:

${\mathbf{Claim}}$: The category of $G$-torsors over $O_x$ is equivalent to the category of $G$-torsors over $O^{\wedge}_x$ equipped with a $K$-descent on its generic fiber over $K_x$.

The categorical aspect of this Claim is essential (i.e., we do not just consider sets of isomorphism classes).

Proof: By fpqc descent theory (the "Beauville-Laszlo step", though for us all we need was provided by Grothendieck) applied to the fpqc cover
$${\rm{Spec}}(K) \coprod {\rm{Spec}}(O^{\wedge}_x) \rightarrow {\rm{Spec}}(O_x)$$
whose fiber square is ${\rm{Spec}}(K_x)$,
the category of affine $O_x$-schemes is equivalent to the category of affine
$O_x^{\wedge}$-schemes equipped with a $K$-structure on the generic fiber over $K_x$. Since the notion of $G$-torsor is well-behaved for the fpqc topology (and recall that fpqc $G$-torsors are automatically etale-topology torsors, due to the smoothness of $G$!!!), this equivalence specializes to the case of $G$-torsors. QED

Now we run the game in reverse. Pick a class in $G(K)\backslash G(\mathbf{A}_X)/G(O^{\wedge})$ represented by some $(g_x) \in G(\mathbf{A}_X)$. Since
$g_x \in G(O^{\wedge}_x)$ for all but finitely many $x \in X^0$, we can pick a Zariski-dense open $U$ in $X$ such that $g_x \in G(O^{\wedge}_x)$ for all $x \in U^0$, so
we may change our representative to satisfy $g_x = 1$ for all $x \in U^0$. Applying the above Claim then enables us to extend the trivial $G_U$-torsor to a $G$-torsor $E$ over $X$ by fpqc-gluing using the elements $g_x$ for each $x \in X - U$ one at a time, and by design this $E$ gives rise to the chosen adelic double coset (if we are careful not to mix up $g_x$ and $g_x^{-1}$ for $x \in X - U$).