RPM'S Running High

Well, given those codes I’d say StrongDreams… was onto something.

P0171 is about running too lean (too much air in the mix, though it could also be too little fuel)

P0507 is just about the idle being higher than expected - a very common cause? Vacuum leak. Is it idling too high?

You still haven’t given the year so no one could say for sure but the vacuum problem messing with the transmission is a possibility.

Put that with inoperable HVAC controls and I’d say that there is probably a vacuum line going from the engine through the firewall to the HVAC that is either disconnected or broken. You can just look all along the firewall very carefully to see if you notice anything amiss. But if you’re not used to looking at all of that stuff under there you might need an experienced eye.