The mode selection is done through a series of air doors that are operated by vacuum. When there is either a partial or total loss of vacuum, the system will default to either defrost or on some vehicles, heat. Acceleration can also have an effect on the doors for the same reason.
Look under the hood for a small black plastic hose coming through the firewall. Follow it to the vacuum source looking for any breaks, cracks or leaks. Also follow any other lines that branch off because they may go to a vacuum reservoir (storage tank) and a leak there will cause the same problem. Using a vacuum gauge to determine if you have full vacuum at any given point is the best way to find it. You can cut into the line anywhere and splice it back together with a piece of vacuum hose. Find the broken line, you found your problem.