Just for the sake of simplicity, assume that the centre of rotation is $(0, 0)$. I know that I can find the destination point $(x', y')$ given angle of rotation $a$ and source point $(x, y)$ using $$\begin{cases} x' = x \cos a - y \sin a \\ y' = x \sin a + y \cos a \\ \end{cases}$$
However, I want to ask how can I find the angle of rotation $a$ given the source point $(x, y)$ and only the x-coordination of the destination point $x'$? The y-coordinate of destination point $y'$ would be according to the angle of rotation $a$ that we get. I am having trouble trying to solve the above equations for the desired value because we don't have exact value of $y'$. It would be great if someone could help. Thanks.
Changing notation a bit, all of the possible rotations of $\mathbf p_0=(x_0,y_0)$ lie on a circle with radius $r = \|\mathbf p_0\| = \sqrt{x_0^2+y_0^2}$. An equation of this circle is $x^2+y^2=x_0^2+y_0^2$. Your problem comes down to finding the points on this circle with $x$-coordinate equal to $x_1$. Plugging $x_1$ into the above equation gives you a quadratic equation with solutions $y_1 = \pm\sqrt{r^2-x_1^2}$. (You can also get this directly from the Pythagorean theorem.) For each of the solutions $\mathbf p_1=(x_1,y_1)$ you can recover the cosine of the angle $\alpha$ via the dot product identity: $$\mathbf p_0\cdot\mathbf p_1 = \|\mathbf p_0\|\,\|\mathbf p_1\|\cos\alpha = r^2\cos\alpha$$ therefore $$\cos\alpha = {x_0x_1+y_0y_1 \over x_0^2+y_0^2}.\tag1$$ Because $\cos\alpha = \cos(-\alpha)$, this equation has a sign ambiguity, but you can resolve it by examining $$\det\begin{bmatrix}\mathbf p_0^T&\mathbf p_1^T\end{bmatrix} = x_0y_1-x_1y_0 = \|\mathbf p_0\|\,\|\mathbf p_1\|\sin\alpha.\tag2$$ You can, if you like, combine these two equations to obtain $$\tan\alpha = {x_0y_1-x_1y_0 \over x_0x_1+y_0y_1}.$$ This also has an ambiguity, this time of the quadrant of the angle, but if you’re coding this, there’s likely a two-argument form of the arctangent function available (often called something like
ATAN2) that allows you to pass the numerator and denominator in separately in order to resolve this ambiguity.