I bought an old system from my friend for $75 and it has a pentium g3258 in it and I was wondering which i5 would be compatible with my system
The G3258 is still a capable processor but, if you want more performance get an i5. Don't sell the G3258 as you can overclock it.
It also depends on the motherboard itself. Please check the manufacturer's website and see if you need a BIOS update before you can use whatever CPU you plan to use on the motherboard.
Indeed. Yet, the OP should check for it and not sell the existing CPU in advance. :)