Okay, here's my very simple minded take on it:
You want to rotate so that vector \vec{v}= x_1\vec{i}+ y_1\vec{j}+ z_1\vec{k} is mapped into \vec{u}= x_2\vec{i}+ y_2\vec{j}+ z_2\vec{k}.
As monea83 and Tac-Tics said, your axis of rotation will be aligned with the cross product, \vec{u}\times\vec{v}= \alpha\vec{i}+ \beta\vec{j}+ \gamma\vec{k} with \alpha= y_1z_2- y_2z_1, \beta= z_1x_2- z_2x_1, and \gamma= x_1y_2- x_2y_1.
The angle of rotation is given by
cos(\theta)= \frac{\vec{u}\cdot\vec{v}}{|\vec{u}||\vec{v}|}= \frac{x_1x_2+ y_1y_2+ z_1z_2}{\sqrt{x_1^2+ y_1^2+ z_1^2}\sqrt{x_2^2+ y_2^2+ z_2^2}}
If the two vectors have the same length, so that we really are rotating one into the other and not just along the same direction, that denominator is x_1^2+ y_1^2+ z_1^2= x_2^2+ y_2^2+ z_2^2. In fact, it wouldn't change the problem to take \vec{u} and \vec{v} to be unit vectors so that we have simply cos(\theta)= x_1x_2+ y_1y_2+ z_1z_2. We don't really need to calculate \theta itself- we only need cos(\theta) and sin(\theta)= \sqrt{1- cos^2(\theta)}.
Now, I presume you know this but some reading this may not- in two dimensions, to rotate vector (x, y) through angle \theta around the origin you need the matrix multiplication
\begin{bmatrix}cos(\theta) & -sin(\theta) \\ sin(\theta) & cos(\theta)\end{bmatrix}\begin{bmatrix}x \\ y \end{bmatrix}
To see that that is true, just look at what happens to the "basis vectors" (1, 0) and (0, 1).
\begin{bmatrix}cos(\theta) & -sin(\theta) \\ sin(\theta) & cos(\theta)\end{bmatrix}\begin{bmatrix}1 \\ 0 \end{bmatrix}= \begin{bmatrix}cos(\theta) \\ sin(\theta)\end{bmatrix}
Dropping a perpendicular from the endpoint (cos(\theta), sin(\theta)) to the x- axis gives a right triangle with "opposite side" cos(\theta) and "near side" sin(\theta) which does, in fact, give a triangle with angle \theta at the origin. That, transforming (1, 0) into (cos(\theta), sin(\theta)) is, in fact, rotating it through angle \theta.
Similarly,
\begin{bmatrix}cos(\theta) & -sin(\theta) \\ sin(\theta) & cos(\theta)\end{bmatrix}\begin{bmatrix}0 \\ 1 \end{bmatrix}= \begin{bmatrix}-sin(\theta) \\ cos(\theta)\end{bmatrix}
and dropping a perpendicular from that endpoint to the y-axis shows that we have a right triangle with angle at the origin of \theta.
In three dimensions, if we rotate around the z-axis, we are just rotating the x and y components as in two dimensions while z stays the same. That is, rotation through angle \theta around the z axis is given by
\begin{bmatrix}cos(\theta) & -sin(\theta) & 0 \\ sin(\theta) & cos(\theta) & 0 \\ 0 & 0 & 1\end{bmatrix}\begin{bmatrix}x \\ y \\ z\end{bmatrix}
From that, by the symmetry of Cartesian coordinates, it is easy to see that rotation through angle \theta about the y-axis is given by
\begin{bmatrix}cos(\theta) & 0 -sin(\theta) \\ 0 & 1 & 0 \\ sin(\theta) & 0 & cos(\theta) \end{bmatrix}\begin{bmatrix}x \\ y \\ z\end{bmatrix}
and that rotation through angle \theta about the x-axis is given by
\begin{bmatrix}1 & 0 & 0 \\ 0 & cos(\theta) & -sin(\theta)\\ 0 & sin(\theta) & cos(\theta)\end{bmatrix}\begin{bmatrix}x \\ y \\ z\end{bmatrix}
To rotate through angle \theta around the arbitrary vector \vec{U}= \alpha\vec{i}+ \beta\vec{j}+ \gamma\vec{k}, we use the following strategy:
1) Rotate around the z-axis so that vector \vec{U} is rotated to the vector \vec{V} in the xz-plane.
2) Rotate around the y-axis so that the vecotr \vec{V} is rotated to the vector \vec{W} parallel to the z-axis.
3) Rotate around the z-axis through angle \theta.
4) Reverse the rotation in (2).
5) Reverse the rotation in (3).
(Apparently this was too long to be posted as a single post so I cut it into two.)