This question has been asked on this site already, but in every related topic I only find references to Hartshorne, where this fact is proven for schemes. I would like to learn about this isomorphism for smooth algebraic varieties (or even smooth in codimension 1) before I go deeper into scheme theory.
The question is about the isomorphism $\text{Cl}(X)\cong \text{Cl}(X\times \mathbb{A^1})$, where $\text{Cl}(X)$ denotes the divisor class group $\text{Div}(X)/\text{P}(X)$. There are two related exercises in Shafarevich's BAG: Chapter 3, $\S$1.8-9.
The first suggests that one should show that the projection $p: X\times \mathbb{A^1} \to X$ induces an epimorphism $p^*: \text{Cl}(X)\to \text{Cl}(X\times \mathbb{A^1})$. The second asks to demonstrate that every divisor $D$ on $X\times \mathbb{A^1}$ is locally principal on some open set $U\times \mathbb{A}^1$.
As far as I understand, the second exercise shows that in $\text{Cl}(X\times\mathbb{A}^1)$ every class is represented by a divisor supported on some closed set $V\times\mathbb{A}^1$. As for the first exercise, the hint suggests considering the section $q: X\to X\times \mathbb{A}^1$, $q(x)=(x,0)$. But from this reasoning it is obvious that $p^*$ is injective, not surjective! Indeed, $p\circ q=\text{id}_X$, so $q^*\circ p^*=\text{id}_{\text{Cl}(X)}$, hence $q^*$ is epic and $p^*$ is monic.
I believe that the first exercise is misleading, and the second one should somehow help showing that $q^*$ is monic or $p^*$ is epic. However, I don't see a way to continue.