A piston is freed and the gas inside is expanded, volume will increase therefore temperature will increase too according to charles law, right? But at the same time pressure will decrease and so temperature will decrease too according to gay-lussac's law? I am very confused, which law should I consider in this case and why? Thank you..
Before you apply any law, the first thing to consider is the conditions, assumptions and special cases (if any).
Charles's Law requires constant pressure. If the pressure is not constant, then you can't use this law. Does it apply here?
For Gay-Lussac's law, you need fixed mass and fixed volume. Does it apply here?
Pressure, volume, temperature, and mass all affect each other. You need two of them to be fixed in order to get direct proportionality between the remaining two.
As LostCause points out, these named laws aren't applicable to your case. But the ideal gas equation, $pV=nRT$, (which yields these laws as special cases) is applicable (provided that the gas density isn't too high).
You'll now see that you don't have enough information to deduce what happens to the temperature using the ideal gas equation. The extra information needed usually comes from the conditions under which the gas expands. For example, we could let the piston out very slowly. This will allow heat to flow into the gas through the cylinder walls, so the gas temperature hardly changes. This is isothermal expansion. At the other extreme, we could let the piston out quickly, so hardly any heat can flow in. This is adiabatic expansion. In this case the work that the gas does pushing out the piston can come only from the gas's internal energy, and its temperature drops. There are an infinite number of different conditions under which the gas could expand.