I bought a phone from someone, and while uploading photos it's uploading them to their OneDrive. How do I change it so photos are uploaded to my OneDrive?
Simply you have hamburger on the left top corner of your OneDrive App, click.
and add your account, and then add your photos there.
if you already added your account there,
just click your account it will open your OneDrive stored documents and there you can upload your photos.
Windows Phone / Windows 10 Mobile requires that you're signed in with a Microsoft Account in order to anything really useful (syncing/email accounts/etc). The fact that the last owner has auto OneDrive upload enabled means they are still signed in on that device.
You should remove that person's account from the phone immediately because they can track you by signing into their online account. The last owner should have done this before selling you the device, because you can also see their account info as well.
In order to remove the root Microsoft Account, you will need to do a reset so you can use your Microsoft Account for the phone. The last owner should have
You can do this from the Settings > About, but I strongly recommend using the Windows Phone Recovery Tool. As a bonus, you'll get the latest firmware and OS build available for your device.