C208 Captain reported on departure flying the wrong SID resulting in flight towards terrain event. ATC vectored the aircraft back on course and climb above the terrain.
Synopsis
C208 Captain reported on departure flying the wrong SID resulting in flight towards terrain event. ATC vectored the aircraft back on course and climb above the terrain.
Narrative
I was flying the second leg of an airplane swap between ZZZ and ZZZ1. I had filed IFR and received the route ZZZ-ZZZZZX-VX Filed and 10;000ft. I programmed the route and departure into the G500 and ForeFlight and verified them.ForeFlight automatically brought up the ZZZZZX SID onto the moving map where I reviewed the initial climb instructions. In this case it was 'climbing right turn to 320 for vectors'. I then switched from Foreflights 'maps' page onto the 'plates' page; in order to reduce visual clutter (NOTAMs/Traffic/weather/etc); and zoomed in onto the initial climb.This was where the screwup started; as I was no longer looking at the ZZZZZX instructions. I was now looking at the ZZZZZY SID; also out of ZZZ. I didn't realize this since I was zoomed in on the instructions with the SID name offscreen. Tower gives the takeoff clearance and I depart Runway XX. I glance over at the (now incorrect) SID instruction and start a left turn towards ZZZZZ2; the first waypoint on the ZZZZZY. Tower instructs me to contact Approach on XXX.X and I check on.At this point in the climb I realize something is wrong; as what I'm seeing on the G500 flight plan is not matching the plate; and waypoints are missing. I thought that I might have deleted the waypoints somehow; and tired reloading the ZZZZZX into the G500. No luck.Right now; the weather is CAVOK VMC; and the airplane is climbing on a heading of 255 towards the first waypoint on the ZZZZZY; albeit without the SID in the G500. I believed I had some time to figure this problem out; since I wasn't at risk of hitting anything.ATC calls with Aircraft X; low altitude alert; minimum altitude for that sector is xxxx" I'm still climbing and on heading; but I realize there's no way I should be getting a warning like that If I'm on the correct SID. ATC vectors me to 320 and asks if I can maintain terrain an obstacle clearance through 6500; which I can.I've now zoomed out on the plate and seen that I had been trying to fly the ZZZZZY instead of the ZZZZZX. With the weather being perfect; I had not felt I needed to immediately ask ATC for help with my troubleshooting.The rest of the flight was uneventful."
Source: NASA Aviation Safety Reporting System (public domain). Reports are voluntary submissions and are not verified by NASA.