For this answer, whenever I say current, I specifically mean conventional current; and whenever I say resistor, capacitor or inductor, I specifically mean constant-resistance resistor, constant-capacitance capacitor and constant-inductance inductor, respectively. Since you're studying AC circuits, I'll assume you've already individually studied resistors, capacitors and inductors. I'll also assume you're familiar with derivatives, and with certain trigonometric identities.
First, let's recall some equations.
In a resistor, the instantaneous current through the resistor is directly proportional to the instantaneous voltage across the resistor:
\$v(t) = R \, i(t) \tag 1\$
In a capacitor, the instantaneous current through the capacitor is directly proportional to the time rate of change of the instantaneous voltage across the capacitor:
\$i(t) = C \, \dfrac{\mathrm dv(t)}{\mathrm dt} \tag 2\$
In an inductor, the instantaneous voltage across the inductor is directly proportional to the time rate of change of the instantaneous current through the inductor:
\$v(t) = L \, \dfrac{\mathrm di(t)}{\mathrm dt} \tag 3\$
Let's consider a resistor. Let's assume the instantaneous current through it is a sinusoid of the form \$i(t) = I_\text{m} \cos{(\omega t + \phi_i)}\$. Then, from equation (1), the instantaneous voltage across it is:
\$\begin{align} v(t) &= R \, [I_\text{m} \cos{(\omega t + \phi_i)}] \\ &= R \, I_\text{m} \cos{(\omega t + \phi_i)} \tag 4 \end{align}\$
that is, it is also a sinusoid of same frequency as the instantaneous current. The current is in phase in time with the voltage.
Next, in a capacitor, let's assume the instantaneous voltage across it is a sinusoid of the form \$v(t) = V_\text{m} \cos{(\omega t + \phi_v)}\$. Then, from equation (2), the instantaneous current through it is:
\$\begin{align} i(t) &= C \, \dfrac{\mathrm d}{\mathrm dt} [V_\text{m} \cos{(\omega t + \phi_v)}] \\ &= C \, [- \omega \, V_\text{m} \sin{(\omega t + \phi_v)}] \\ &= - C \, \omega \, V_\text{m} \cos{(\omega t + \phi_v - 90^\circ)} \\ &= C \, \omega \, V_\text{m} \cos{(\omega t + \phi_v - 90^\circ + 180^\circ)} \\ &= C \, \omega \, V_\text{m} \cos{(\omega t + \phi_v + 90^\circ)} \tag 5 \end{align}\$
that is, it is also a sinusoid of same frequency as the instantaneous voltage. The current leads the voltage by 90° in time.
Next, in an inductor, let's assume the instantaneous current through it is a sinusoid of the form \$i(t) = I_\text{m} \cos{(\omega t + \phi_i)}\$. Then, from equation (3), the instantaneous voltage across it is:
\$\begin{align} v(t) &= L \, \dfrac{\mathrm d}{\mathrm dt} [I_\text{m} \cos{(\omega t + \phi_i)}] \\ &= L \, [- \omega \, I_\text{m} \sin{(\omega t + \phi_i)}] \\ &= - L \, \omega \, I_\text{m} \cos{(\omega t + \phi_i - 90^\circ)} \\ &= L \, \omega \, I_\text{m} \cos{(\omega t + \phi_i - 90^\circ + 180^\circ)} \\ &= L \, \omega \, I_\text{m} \cos{(\omega t + \phi_i + 90^\circ)} \tag 6 \end{align}\$
that is, it is also a sinusoid of same frequency as the instantaneous current. The voltage leads the current by 90° in time, or equivalently the current lags the voltage by 90° in time.
From equations (4) to (6), we can see that whenever we apply a sinusoidal current or voltage to a resistor, capacitor or inductor, the resulting voltage or current is also sinusoidal of same frequency. Keep this fact in mind. Let's call this observation #1. (Actually, this is true after some time has passed, and the so-called transients have decayed to zero and steady-state has been reached, but let's ignore this.)
Also, as you may know, we can combine sinusoids of different amplitude and different phase angle but same frequency into one sinusoid of different amplitude, different phase angle but also same frequency. Read this page if you don't know. Let's call this observation #2.
Kirchhoff's voltage law states that a sum of instantaneous voltages is zero, and Kirchhoff's current law states that a sum of instantaneous currents is zero:
\$\displaystyle\sum_{n=1}^{N} v_n(t) = 0 \tag 7\$
\$\displaystyle\sum_{n=1}^{N} i_n(t) = 0 \tag 8\$
In a circuit that consists only of resistors, inductors, capacitors, and independent sinusoidal voltage and current sources of same frequency, Kirchhoff's laws along with observation #1 indicate that in AC circuits, we will be summing instantaneous voltages and currents of same frequency. Let's call this observation #3. These sums of sinusoidal signals will result in signals that are also sinusoidal and of same frequency, as we saw in observation #2.
Let's briefly talk about phasors.
As you may know, a sinusoidal signal of the form \$x(t) = X_\text{m} \cos{(\omega t + \phi)}\$, which is really a real function of real variable, can be partially represented as a complex constant of the form \${\tilde X} = X_\text{m} e^{j \phi} = X_\text{m} \, \angle \phi = X_\text{m} \cos{(\phi)} + j \sin{(\phi)}\$, called a phasor. The relationship between a phasor and its corresponding signal is \$x(t) = \Re{[{\tilde X} \, e^{j \omega t}]}\$.
Notice the phasor does not include the cyclic frequency or angular frequency of the signal, and thus, doesn't completely represent the signal. But this doesn't matter because as we saw, all signals in an AC circuit consisting of independent sources of same frequency, resistors, capacitors and inductors, will have the same frequency.
(Complex) impedance is defined as the ratio of phasor voltage to phasor current:
\${\hat Z} = \dfrac{\tilde V}{\tilde I} \tag 9\$
Let's find the (complex) impedance of the three passive elements.
For a resistor, in equation (4), the instantaneous current is \$i(t) = I_\text{m} \cos{(\omega t + \phi_i)}\$, which can be written as \$i(t) = \Re{[{\tilde I} \, e^{j \omega t}]}\$, where the phasor current is:
\${\tilde I} = I_\text{m} \, e^{j \phi_i}; \tag*{}\$
and the instantaneous voltage is \$v(t) = R \, I_\text{m} \cos{(\omega t + \phi_i)}\$, which can be written as \$v(t) = \Re{[{\tilde V} \, e^{j \omega t}]}\$, where the phasor voltage is:
\${\tilde V} = R \, I_\text{m} \, e^{j \phi_i}. \tag*{}\$
Thus, the (complex) impedance of a resistor is:
\$\begin{align} {\hat Z} &= \dfrac{R \, I_\text{m} \, e^{j \phi_i}}{I_\text{m} \, e^{j \phi_i}} \\ &= R = R \, \angle 0^\circ \tag {10} \end{align}\$
Next, for a capacitor, in equation (5) the instantaneous voltage is \$v(t) = V_\text{m} \cos{(\omega t + \phi_v)}\$, which can be written as \$v(t) = \Re{[{\tilde V} \, e^{j \omega t}]}\$, where the phasor voltage is:
\${\tilde V} = V_\text{m} \, e^{j \phi_v}; \tag*{}\$
and the instantaneous current is \$i(t) = C \, \omega \, V_\text{m} \cos{(\omega t + \phi_v + 90^\circ)}\$, which can be written as \$i(t) = \Re{[{\tilde I} e^{j \omega t}]}\$, where the phasor current is:
\${\tilde I} = C \, \omega \, V_\text{m} e^{j (\phi_v + 90^\circ)}. \tag*{}\$
Thus, the (complex) impedance of a capacitor is:
\$\begin{align} {\hat Z} &= \dfrac{V_\text{m} \, e^{j \phi_v}}{C \, \omega \, V_\text{m} \, e^{j (\phi_v + 90^\circ)}} \\ &= \dfrac{1}{C \, \omega \, e^{j 90^\circ}} \\ &= \dfrac{1}{j \, \omega \, C} = -\dfrac{j}{\omega \, C} = \dfrac{1}{\omega \, C} \, \angle -90^\circ \tag {11} \end{align}\$
Next, for an inductor, in equation (6) the instantaneous current is \$i(t) = I_\text{m} \cos{(\omega t + \phi_i)}\$, which can be written as \$i(t) = \Re{[{\tilde I} \, e^{j \omega t}]}\$, where the phasor current is:
\${\tilde I} = I_\text{m} \, e^{j \phi_i}; \tag*{}\$
and the instantaneous voltage is \$v(t) = L \, \omega \, I_\text{m} \cos{(\omega t + \phi_i + 90^\circ)}\$, which can be written as \$v(t) = \Re{[{\tilde V} e^{j \omega t}]}\$, where the phasor voltage is:
\${\tilde V} = L \, \omega \, I_\text{m} \, e^{j (\phi_i + 90^\circ)}. \tag*{}\$
Thus, the (complex) impedance of an inductor is:
\$\begin{align} {\hat Z} &= \dfrac{L \, \omega \, I_\text{m} \, e^{j (\phi_i + 90^\circ)}}{I_\text{m} \, e^{j \phi_i}} \\ &= L \, \omega \, e^{j 90^\circ} \\ &= j \, \omega \, L = \omega \, L \, \angle 90^\circ \tag {12} \end{align}\$
If you inspect equations (10) to (12), you'll see in equation (9), the phase angle between the instantaneous current and instantaneous voltage of a resistor, capacitor and inductor is taken into account in the phase angle of the (complex) impedance. I think this answers your question:
How could the current be calculated using I = V/Z, even though I and
source V are not in phase?
In case you're referring to the amplitudes/peak values/maximum values, then take the magnitude of the (complex) impedance of equation (9):
\$\begin{align}|{\hat Z}| &= \left| \dfrac{\tilde V}{\tilde I} \right| \\ &= \dfrac{|\tilde V|}{|\tilde I|} \\ &= \dfrac{|V_\text{m} \, e^{j \phi_v}|}{|I_\text{m} \, e^{j \phi_i}|} \\ &= \dfrac{V_\text{m}}{I_\text{m}} \tag {13} \end{align},\$
and there you have it, the previous equation shows that we can calculate the magnitude of the (complex) impedance simply as the ratio of the peak voltage to the peak current.
In case you're referring to the RMS/effective values, then recall the RMS value of a sinusoidal signal is \$X_\text{RMS} = X_\text{m}/\sqrt{2}\$, from which we get the peak value as \$X_\text{m} = \sqrt{2} \, X_\text{RMS}\$. Substituting this in equation (13):
\$\begin{align}|{\hat Z}| &= \dfrac{\sqrt{2} \, V_\text{RMS}}{\sqrt{2} \, I_\text{RMS}} \\ &= \dfrac{V_\text{RMS}}{I_\text{RMS}} \tag {14} \end{align},\$
and there you have it, the previous equation shows that we can calculate the magnitude of the (complex) impedance simply as the ratio of the RMS voltage to the RMS current.
Note that in equations (13) and (14), the phase angles aren't needed; we only work with magnitudes in those equations.
Equation (9) is Ohm's law generalized to the phasor domain. Let's check if Kirchhoff's laws generalize to the phasor domain. KVL states that:
\$\displaystyle\sum_{n=1}^{N} v_n(t) = v_1(t) + v_2(t) + \cdots + v_N(t) = 0 \tag*{}\$
In AC circuits, as we saw all voltages will have the same frequency, so we can write the previous instantaneous voltages in terms of their phasors:
\$\begin{align} 0 &= \Re[{\tilde V_1} \, e^{j \omega t}] + \Re[{\tilde V_2} \, e^{j \omega t}] + \cdots + \Re[{\tilde V_N} \, e^{j \omega t}] \\ &= \Re[{\tilde V_1} \, e^{j \omega t} + {\tilde V_2} \, e^{j \omega t} + \cdots + {\tilde V_N} \, e^{j \omega t}] \\ &= \Re[({\tilde V_1} + {\tilde V_2} + \cdots + {\tilde V_N}) e^{j \omega t}] \tag*{} \end{align}\$
The previous equation says that (the real part of) the product of the factors \$({\tilde V_1} + {\tilde V_2} + \cdots + {\tilde V_N})\$ and \$e^{j \omega t}\$ is zero, therefore one (or both) of those factors must be zero. But \$e^{j \omega t}\$ is never zero, so the first factor must be zero:
\${\tilde V_1} + {\tilde V_2} + \cdots + {\tilde V_N} = \displaystyle\sum_{n=1}^{N} {\tilde V}_n = 0, \tag*{}\$
which has the same form as KVL for instantaneous voltages! So KVL holds true for phasors. The same can be said about KCL.
So, we can use generalized Ohm's law and Kirchhoff's laws to analyze and design AC circuits, by using complex numbers.