I presume that your variety $X$ is smooth.
Consider the additive map $\mathrm d\log \colon \mathscr O_X^*\to \Omega^1_X$ that sends $f$ to $\mathrm df/f$. It induces a map $c_1$ in cohomology from $H^1(X,\mathscr O_X^*)$
to $H^1(X,\Omega^1_X)$ — a coherent avatar of the first Chern class.
By Hodge Theory, $H^1(X,\Omega^1_X)$ is a subspace of $H^2(X,\mathbf C)$ and the two notions
of first Chern class coincide.
A line bundle $\mathscr L$ has a connection if and only if its first Chern class $c_1(\mathscr L)\in H^1(X,\Omega^1_X)$ vanishes. The proof is straightforward: take an open cover $(U_i)$ of $X$, an invertible section $s_i$ of $\mathscr L$ on $U_i$ and the associated cocycle $(f_{ij})$ representing your line bundle in $H^1(X,\mathscr O_X^*)$. A connection $\nabla$ maps $s_i$ to $s_i\otimes\omega_i$, for some 1-form $\omega_i\in H^0(U_i,\Omega^1_X)$. The condition that these $s_i\otimes\omega_i$ come from a global connection on $X$ is exactly the vanishing of $c_1(\mathscr L)$.
It is a non-trivial fact that if $\mathscr L$ has an algebraic connection, then it is automatically flat. Torsten Ekedahl gave an algebraic proof on this thread of MO
(Ekedahl also observes that $p$th power of line bundles in characteristic $p$ have an integrable connection), but an analytic proof seems easy. The algebraic connexion $\nabla$ gives rise to a connexion $\nabla+\bar\partial$ on the associated holomorphic line bundle. One checks that the curvature of this connection is a $(2,0)$-form, while it should be a $(1,1)$-form. Consequently, it vanishes.
When non empty, the set of flat connections on a vector bundle $\mathscr E$ is an affine space under $H^0(X,\Omega^1_X\otimes\mathscr E\mathit{nd}(\mathscr E))$, a finite dimensional vector space. In our case, $\mathscr L$ is a line bundle, hence $\mathscr E\mathit{nd}(\mathscr L)$ is the trivial line bundle so that we get $H^0(X,\Omega^1_X)$.
NB. Following the comment of Ben McKay, I edited the last paragraph.
There is no such isomorphism (at least for $g \geq 9$).
In
O. Randal-Williams, The Picard group of the moduli space of r-Spin Riemann surfaces. Advances in Mathematics 231 (1) (2012) 482-515.
I computed the Picard groups of moduli spaces of Spin Riemann surfaces (for $g \geq 9$). Grothendieck--Riemann--Roch shows that, in the notation of that paper, the right hand side of your formula is the class $\lambda$, and the left-hand side is the class $\lambda^{1/2}=2\mu$. (See page 511 of the published version for the calculation of the latter; the preprint has some mistakes at this point.)
But the Picard group has presentation $\langle \lambda, \mu \,\vert\, 4(\lambda + 4\mu)\rangle$ as an abelian group, so these are not equal (even modulo torsion).
You should not really need my calculation to see this: you can calculate the rational first Chern class of both sides by GRR, and see that they are distinct multiplies of the Miller--Morita--Mumford class $\kappa_1$; all that remains to know is that $\kappa_1 \neq 0$, which was shown in
J. L. Harer, The rational Picard group of the moduli space of Riemann surfaces with spin structure. Mapping class groups and moduli spaces of Riemann surfaces (Göttingen, 1991/Seattle, WA, 1991), 107–136, Contemp. Math., 150, Amer. Math. Soc., Providence, RI, 1993.
EDIT: To answer the question in the comments.
Yes, I think that (in my notation) the relation $4(\lambda + 4\mu)=0$ holds for $g \geq 3$ (for $g < 3$ it can probably be checked by hand). To see this, let me shorten notation by writing $\mathcal{M}_g = \mathcal{M}_g^{1/2}[\epsilon]$ for the moduli space of Spin Riemann surfaces of Arf invatriant $\epsilon \in \{0,1\}$, $\pi : \mathcal{M}_g^1 \to \mathcal{M}_g$ for the universal family (i.e. $\mathcal{M}_g^1$ is the moduli space of Spin Riemann surfaces with one marked point), and $\mathcal{M}_{g,1}$ for the moduli space of Spin Riemann surfaces with one boundary component.
Firstly, the Serre spectral sequence for $\pi$ has
$$E_2^{0,1} = H^0(\mathcal{M}_g ; H^1(\Sigma_g ; \mathbb{Z}))$$
and one can show that this is zero: the fundamental group of $\mathcal{M}_g$ acts on $H^1(\Sigma_g ; \mathbb{Z}) = \mathbb{Z}^{2g}$ via a surjection onto a finite-index subgroup of $\mathrm{Sp}_{2g}(\mathbb{Z})$, but this finite-index subgroup will still be Zariski-dense in $\mathrm{Sp}_{2g}(\mathbb{C})$, so the (complexified) invariants will be zero.
It follows from the Serre spectral sequence that
$$\pi^* : H^2(\mathcal{M}_g; \mathbb{Z}) \to H^2(\mathcal{M}_g^1; \mathbb{Z})$$
is injective, so it is enough to prove the relation when there is a marked point. In fact, it even follows that
$$H^2(\mathcal{M}_g; \mathbb{Z}) \oplus \mathbb{Z}\cdot e \to H^2(\mathcal{M}_g^1; \mathbb{Z})$$
is injective, where $e$ denotes the Euler class of the vertical tangent bundle of $\pi$.
Now there is a fibration sequence
$$\mathcal{M}_{g,1} \to \mathcal{M}_g^1 \overset{\frac{e}{2}}\to BSpin(2)$$
and so, from the Serre spectral sequence, an exact sequence
$$0 \to \mathbb{Z}\cdot \frac{e}{2} \to H^2(\mathcal{M}_g^1;\mathbb{Z}) \to H^2(\mathcal{M}_{g,1};\mathbb{Z}) \overset{d^2}\to H^1(\mathcal{M}_{g,1};\mathbb{Z}).$$
Now it follows from
A. Putman, A note on the abelianizations of finite-index subgroups of the mapping class group, Proc. Amer. Math. Soc. 138 (2010) 753-758.
that for $g \geq 3$ the fundamental group of $\mathcal{M}_{g,1}$ has torsion abelianisation, so its first cohomology is zero. Putting it all together, we get an injection
$$H^2(\mathcal{M}_g; \mathbb{Z}) \to H^2(\mathcal{M}_{g,1}; \mathbb{Z}),$$
so it is enough to verify the relation $4(\lambda + 4\mu)=0$ on $\mathcal{M}_{g,1}$. But for $g \leq 9$ there is a map
$$\mathcal{M}_{g,1} \to \mathcal{M}_{9,1} \to \mathcal{M}_9,$$
given by gluing on 2-holed tori then a disc, so the relation holds because it holds on $\mathcal{M}_9$.
Best Answer
For $G={\rm PGL}_n({\mathbb C})$ there is no complex algebraic Quillen line bundle on the complex character variety $Y$ as the cohomology class $[\omega]=\alpha_2\in H^2(Y;{\mathbb Q})$ is not pure by Proposition 4.1.8 in http://arxiv.org/abs/math.AG/0612668.
EDIT: It is instructive to think about the case $G={ GL}_1({\mathbb C})$. Then the character variety is $M_B=GL_1^{2g}$ the complex torus while $M_{DR}$ is an affine bundle over $Jac(C)$. Analytically $M_B\cong M_{DR}$ but the universal bundle $L$ on $M_{DR}\times C$ which is just the pull back of the Poincare bundle from $Jac(C)\times C$ is not algebraic on $M_B$, for example because the cohomology class $[\omega]$ of the symplectic form (which shows up in $c_1(L)^2$) has weight $2$ in $H^2(M_{DR};{\mathbb Q})$ but has weight $4$ (homogeneous weight $2$) in $H^2(M_B;{\mathbb Q})$. Thus in particular there is no complex algebraic Quillen bundle on $M_B$ with first Chern class $[\omega]$.
EDIT 2: To take David's example let $g=1$, then $M_B={\mathbb C}^* \times {\mathbb C}^*$ which does not have non-trivial pure cohomology in $H^2(M_B;{\mathbb Q})$ and even the Picard group is trivial (see an argument here); thus $M_B$ does not support any non-trivial algebraic line bundle.