First of all, note that when making a suggestion, it is used the same construction than when comparing two things (ほうが 方が), because they are being compared 2 ways of doing things, namely the way how it is done as for now vs a better way to do it, i. e the suggested way.
After that, think of the ~た ending not as "past" but as "done" or "after", for example like in「家に帰った時、 ごはんをたべます。」(I have lunch once I've come back home).
Then, think of a suggestion as a guideline to either:
1) reach some desirable outcome or state. I am at A but I want B.
2) keep the current state of things. I am at A and I want to keep A.
Let's see both cases.
When suggesting to do something in Japanese, you tell that "How things would turn out [after an action is carried out and as a result there is a desirable state] is better". An action must be done in advance in order to reach that desired state, thus it is used 〜た.
e.g. 勉強したほうがいいです → "The way of having studied is good [to pass the exam]" → Having studied is better → You'd better study.
You are at A (an ignorant who wouldn't pass) and want B (a knowledgeable person who would pass).
But what happens when you suggest not to do something? In this case there is no action that triggers the desirable state as a result, but rather the desirable state is what would be expected to happen if you do not screw it up by doing something bad or not recommended. Not doing the hindering action must be ensured during the whole time span indefinitely in order to keep the desired state in place, thus it is used 〜ない (non-past).
e.g. ケーキを食べないほうがいいです →"The way of not eating cake is good [to keep fit] → "Not eating cake is better [to keep fit]" → you'd better not eat cake.
You are at A (in good shape) and want to keep A (in good shape).