I assume you are talking a corny keg?
Yes, the CO2 you pressurize it with will carbonate it, or you can naturally carbonate it.
How long is between over night and up to I think they say three weeks.
There's a reason that the timeframe is so wide. First, you have to figure out how much carbonation you want. Next, there are charts that will tell you how to get there.
The slow method is to figure out the CO2 volume you want and the temperature that the keg will be at, then the chart will tell you 10 psi or whatever it is and how long. You will want to serve at that pressure also because if you run it at a couple psi so that it pours well through a picnic tap, the carbonation will bleed out of the beer just like if the cap is off a bottle and the beer is no longer pressurized. You can adjust for a good pour with things like line length from the keg to the tap. Essentially a longer line takes more pressure to get the beer through. The pressure is the energy that pushes it so the more it pushes, the less energy is left at the tap. Less energy makes for full flow without it shooting out and foaming up.
There is also a super fast method that I read like this.
Pressurize the keg to 60psi, pull the gas line off and pick the keg up and shake it till you can't do it any more. ( Shaking it gives the gas more surface area to get the gas into the beer so it doesn't have to reach the bottom by going all the way through the beer) The gas get's absorbed by the beer, carbonating it, so you need to add more to bring it back to 60psi. Next do the shaking thing again.
Repeat till you can't do it any more.
Leave it at 60psi, the next day bleed off the pressure, bring it to serving pressure and let it sit for at least an hour. Serve.
I do something in between. I run the pressure up, shake it around, top off the gas and let it sit for a couple days in the kegerator. Then I bleed off the pressure, bring it to serving pressure and give it an hour or two.
Using the chart and giving it time is really the best way. You will be more consistent.
When you fill the keg, it's a good idea to purge the air with the CO2 first. Oxygen isn't the friend of good beer.