Heat and ac problems re worded

recently my heat/ ac will just randomly turn off and turn back on whenever it feels like it, and also when i try to lower or raise the temp it changes cd player to the tuner to aux and so on its really weird and my dad was going to help me fix it just wondering if u guys had an idea of what it could be so we dont waste a bunch of time trying to figure it out any ideas? … (i posted something similar but worded it wrong) its a 2002 hyundai xg350l

Is this the one with an aftermarket head unit that was wired directly to the vehicles harness instead of using an adapter?

I would unplug the radio and check it again.