The map you describe $Cacl(X)\to Pic(X)$ sending the linear equivalence class $[D]$ of a Cartier divisor $D$ to the line bundle $\mathcal O(D)$ is always injective.
It is very often surjective: it is the case if $X$ is integral or if $X$ is projective over a field.
However Kleiman has given a complicated example of a complete non-projective 3-dimensional irreducible scheme on which there is a line bundle not having any non-zero rational section and thus not coming from a Cartier divisor.
The scheme $X$ is obtained from Hironaka's complete, integral, non-singular, non projective variety of dimension 3 (which is already a strange beast!) by adding nilpotents to the local ring of just one point.
The details can be found in Hartshorne's Ample Subvarieties of Algebraic Varieties , Chapter I, Example 1.3, page 9.
Here is a picture (in blue) of Hironaka's strange beast . The description is on page 185 of Shafarevich's book.