OK, let's firstly eliminate 'possibilities'.
Going through this list step-by-step will isolate the problem to either your phone or to the network.
Feel free to skip any parts that you have already tried, e.g. 'was your SIM working previously?'
Sorry, it is a bit of a 'list', it is a 'catch all possibilities' reply but it will certainly help you to pinpoint the problem.
Firstly, if you have just activated your SIM it can take up to 24 hours for the full activation process to complete, a periodic restart will help.
Have you restarted your device since the problem became evident? This simple action often clears 'problems'.
If you have an iPhone, please try a resync with iTunes.
Do you have an active goodybag? Please dial 1007# to check
Do you have credit? (needed if you don't have a goodybag or for any international calls/texts) Please dial *100# to check
LOCAL SERVICE PROBLEMS
Are there local service issues? Please enter your FULL postcode here to check http://status.o2.co.uk/
If service issues are shown you can use the same site to register for updates on the resolution of these.
Was your giffgaff SIM working previously?
Is your device actually unlocked (or at least locked to O2)? Even an unactivated giffgaff SIM will display signal bars/dots and will not request a 'network PIN', 'SIM unlock code' or display a 'SIM not supported' message on an unlocked phone.
Do you get any signal bars? No signal bars is a pretty clear sign that the device is still locked to a network other than O2 / giffgaff.
Have you tried / can you please try the SIM in another (definitely unlocked) device? If it works then your device is still locked and you need to either contact the previous network on which the device was used or a good mobile unlocking service.
If your phone continues to show an 'unavailable' message with a different sim card I would recommend that you visit www.checkmend.com/uk to check the IMEI status of your phone (alternatively www.imeipro.info which is a free website). If your device was purchased second hand it is possible that it is blacklisted (and has been reported as lost or stolen).
It could be that your SIM is 'failing in service'. Rare but it does happen
This is easy to resolve.
Please order a new SIM from:
When it arrives, you will need to perform a simple SIMswap.
Your current number and any goodybag / credit will transfer as part of the process.
Don't forget to back up any contacts on your SIM as these do not transfer as part of the process.
I hope that this helps you to solve the problem.