With most cell phones there is an option in the settings to enable the WiFi option and all you have to do is enable it and then you'll be able to see the networks within range of the phone. You would then select your network and enter in the network password which will connect you to the wireless router and you can access the internet.
If you have done these steps and you still cannot connect then you may have a defective phone or software and you should contact your cell phone provider for assistance.
In such cases one should visit to the authorised service centre of samsung with original mobile bill. Every mobile company offers 1 year manufacturer warranty. If your product is within 1 year warranty period, the problem with the phone will be solved free of cost.