Let me tell what I understand of the concepts on which the question is based first.
Heat is a flow of energy that takes place due to a temperature gradient.
When doing reversible isothermal expansion of an ideal gas, even though there is no net change in the system's temperature before and after the process, each time we take a differential pressure off the system, there is a differential work done by the gas which creates a differential temperature difference in the system and surrounding and so the differential heat flow, which is the added to get the total heat exchanged in the process.
Then there is the case of free expansion. In this case, even though the gas expands, as it is done against $0$ pressure there is no work done in any step, so there is no, not even differential, flow of heat in any of the steps involved in the process. Also, as the final and initial temperatures are the same in this process, we can safely say that there is a possible way for reaching the final state achieved in free expansion, from the same initial states, isothermally.
Question: Let's take two process into account for going from state $(P_1, V_1, T)$ to state $(P_2,V_2,T)$. One via an isotherm and other via free expansion. Entropy for the first process (isothermal) is going to be $\Delta S=\int \frac{dq}{T}$ . As T is constant, the integral becomes $\Delta S=\frac{Q}{T}$. As for the second process (Free Expansion), $dQ$ is $0$ for every step and $T$ is constant for every step. this yields $\Delta S=0$ . But entropy is a state function, so the value for both processes $1$ and $2$ should be the same. So what is going on here? Is there something wrong with my understanding of free expansion?