Flight Crew Air Transport Pilot (ATP); Flight Crew Instrument; Flight Crew Multiengine
Confusion; Human-Machine Interface
Deviation / Discrepancy - Procedural Clearance; Inflight Event / Encounter CFTT / CFIT
Flight Crew Took Evasive Action
Human Factors; Software and Automation
It was the Captain's leg on a return flight from ZZZ when we were given the ZZZZZ3 SID. We were given a standard take off clearance from Runway XXL (no heading; altitude; or fix to fly) and I; as the pilot monitoring; engaged the autopilot modes as directed. When I engaged the NAV mode; it did not arm FMS but instead HDG mode. After double-checking I correctly engaged NAV mode; we were still in HDG with the only white needle navigation being from ZZZZZ to ZZZZZ1 and then on the rest of the departure. Since we were still in HDG mode with what I remember was runway heading bugged; we were heading directly for the terrain off of the departure end of XXL. We received hasty instructions from ATC to turn left immediately to get away from the terrain; which we complied with. We were in VMC and could clearly see the terrain; which we had already climbed above when the instructions from ATC came through to start the immediate turn. We never received a GPWS terrain alert. Once established heading back to ZZZZZ on the departure; the Captain had disengaged and reengaged the NAV button to finally arm FMS mode. ATC then advised us to resume the departure and continue our assigned climb altitude to 17;000 feet. No further communications between us and ATC about what had happened. The rest of the flight went on normally and without incident. Really make sure on RNAV departures that when you select the NAV button that the FMS mode activates and if needed spin the heading bug to the headings provided on the charts to avoid conflicts like this.
Air Carrier First Officer flying CRJ-900 aircraft reported flying toward terrain on departure.