Welcome to iMore! You're going to want to go to Settings > General > Reset > Erase All Content & Settings. Once the process is complete, set it up as a new device and update your phone to the latest version of iOS. While you're at it, make sure that Find My iPhone is turned off in Settings > iCloud. If it's still on you'll want to contact whomever sold you the phone and have them turn it off with their iCloud password or your phone will be worthless once you restore it.
Good luck and let us know if you have any more questions!