Think about the problem backwards, how would we rotate C around A so that it lines up with B. If we can solve this problem, we just need to rotate A by the same amount, but in the opposite direction.
If you're familiar with linear algebra, this should be pretty straight forward. If you're not, I can try and write up some pseudo-code to complement this answer.
From the above diagram, we can see that B (the gun) forms a line if sight (green), a straight line (2D or 3D), we know that we want C somewhere along this line. Since we're rotating around A, the distance (d) between A and C will remain the same, so we just need to find the 2 points (x1 and x2) along the line which satisfy this. Construct a right angle triangle (A x3 x2), where x3 is the point on the line closest to A. Using the Pythagorean theorem, we can get y. And from y we can get both x1 and x2. Choose the point which point is in front of the gun, not behind. Finally we can get the axis of rotation, and the angle of rotation (theta). The axis can be obtained by the cross product between the vectors (x2-A)x(C-A). The angle (theta) can be found by taking the inverse cosine of the dot product between the same vectors after normalization.
That should give you the inverse rotation, so just rotate A by negative theta, around the same axis.
I haven't walked through the math myself, but is should simplify into a fairly short algorithm.
Note: in 2D there is only 1 solution, but in 3D there are infinite rotations that satisfy your problem. My solution will find the smallest rotation, which may not be the most natural looking for a guy aiming a gun.