I know normally, you have to pay to get an unlock code, but I was wondering, is there any way to get one for free? I heard that you could call AT&T customer service and get one for free over the phone.
Quite simply, no.
Oh and according to my friend who gave me this phone, it has been reported stolen like a year or so ago. Can it still be unlocked?
Yes, but it can't be used, on AT&T or on any other carrier. No carrier in the US will activate a stolen phone. (Even if it was your friend's and he got it back. There's a LONG process HE'D have to go through to get it off the list. It usually isn't worth it.)
Also, is there such a thing as unlock code generators?
For old (meaning around 2012) Nokia phones.
And, does my phone need to be rooted first before unlocking it?
No, it should be non-rooted.
Any help/advice would be greatly appreciated! I want to be able to use this phone as a prepaid.
Since it's been reported stolen you can't use it, period. (Unless you're planning on using it in some small country that has a phone company owned by a friend of yours, or the dictator of the country is a friend.)
My advice is to stop trying to get around the system (they've thought of everything you're going to think of, and they've got it covered, including things like "possession of stolen property") and buy a phone.
Oh, and if the phone had never been reported stolen, SOME carriers will give you the unlock code - for free - as long as the phone is no longer in contract, there are no outstanding bills, and it's still activated.
TMobile is the easiest (and always has been) - after about 30-40 days after you got the phone - while still under contract - they'll give you the unlock code if you're planning on being out of the country and want to buy a local SIM to use while there. AT&T might - it depends on the phase of the moon and the mood of the customer service rep you get.
But that's for a phone you can use. The one your friend had is now good only for parts to repair other phones.