If it's running iOS 4.2.1, chances are it is not an iPhone 3GS. It is more likely an iPhone 3G. The 3G can not run anything higher than 4.2.1.
IF it is a 3GS, you can update it to iOS 6.1.3 by plugging it into your computer running iTunes. It should detect that there is a newer version available and allow you to update.
Before you start thinking about what carrier you're going to use, you need to find out if the phone is carrier locked or not. More than likely, it's locked to AT&T, meaning you have no choices of carriers other than AT&T. ONLY AT&T can unlock the phone. If you are not the original owner of the phone, it's unlikely they will do so. AT&T does not allow iPhones on their pre-paid plans. Only on post paid plans, and they require a data package. Given that the iPhone 4, which is 2 generations newer than the phone you have, is free with a 2 year contract, I don't see why you would even bother with the 3G at this point. It's obsolete. It has been discontinued for several years, and it is about to fall even further behind when iOS 7 comes out in a few months.
As for upgrading to an iPhone 5 with no money involved... It's not going to happen. Not unless you want to risk going to jail. Why do you think you would be able to upgrade to an iPhone 5 for free?