The subjunctive in Spanish is not a tense but rather a 'mood', which we do not have in English, and it is triggered by certain structures or subject matters. We can use either the present subjunctive or the imperfect subjunctive. The easiest way to remember when to use the subjunctive is the WEIRDO acronym:
W (Wishes) - only to be used when ordering/wishing another person carries out a task (e.g. I want him to clean the dishes - Quiero que él lave los platos)
E (Emotion) - when something or someone causes you to feel a certain way (e.g. it makes me angry that he snores - Me enoja que él ronque).
I (Impersonal Observations) - It's good that.., It's important that.., It's possible that... etc. (e.g. it's important that the government spends money on education - Es importante que el gobierno gaste dinero en educación).
R (Recommendations) - recommending or suggesting that someone does something (e.g. I recommend that you drink 2 litres of water a day - Recomiendo que bebas al menos dos litros de agua al día).
D (Doubt/Disbelief) - the most common use of the subjunctive (e.g. I doubt that it will rain this afternoon - Dudo que llueva esta tarde). Whilst general opinion structures such as creo que and pienso que do not require the subjunctive, if they are negative (no creo que, no pienso que) then they are followed by the subjunctive.
O (Ojalá) - either on its own or followed by que both require the subjunctive, its is translated roughly as I wish, I hope, God willing, let's hope. It is a general form of expression rather than being person-specific. (e.g. I hope it doesn't rain! - ¡Ojalá no llueva!). I'll also use an imperfect subjunctive example: (I wish I were rich! - ¡Ojalá fuera rica!). In the same way as English, the use of the imperfect past tense (I was/were) means it is also used in these structures in the imperfect subjunctive form. However, this tense will require separate explanation.
The final point is S (Speculation). There are certain adverbial conjunctions to express conditions and times in which things may occur. The main ones are para que... (so that), tan pronto como... (as soon as), a menos que (unless). E.G. We'll go out as soon as you brush your teeth - Saldremos tan pronto como te laves los dientes.
As you have probably seen, in many cases the subjunctive is triggered by the use of 'que', but be cautious - structures like tengo que (I have to...) require the infinitive verb afterwards. E.G. I have to do my homework - Tengo que hacer mis deberes. He has to do his homework - Tiene que hacer sus deberes.
Therefore normally, the subjunctive is used in cases where the subject of the sentence is changed, signified by the use of que. E.G. I want to play football - quiero jugar al futbol. I want him to play football - quiero que él juegue al futbol.