Why would a 1997 Grand Prix GT refuse to go over 40 mph even though the RPMs continue to climb during acceleration?

The reason the rpm will go up but the car doesn't go higher than 40mph, may be that the transmission gears are burnt. you should take it to a transmission specialist to get a better diagnose. Burnt or low tranny fluid i would say that you have a plugged catylatic converter. your rpms will increase and you gain no speed