"Wenn" and "als" are both used to talk about when something happened.
When talking about the past, we use "als" if it occured once and "wenn" if it occurred more than once.
When talking about the present or future, we always use "wenn."
Always use "wenn":
In both the present and future, "wenn" can be used as a conditional (like "if...") and to express a point in time (like "when...").
When talking about the past, you have to choose between "als" or "wenn." Use "als" when it only happened once. Otherwise use "wenn":
Both "wenn" and "als" are subordinate conjunctions: they go at the beginning of a subordinate clause and send the verb to the end of the clause.
The subordinate clause can come before or after the main clause. Put the most important clause first.
When it's obvious from the context, you can leave out the main clause:
If it's not clear from the context, you have to say the whole thing:
Usually the subordinate clause comes before the main clause, but either way is possible.
If it's obvious from the context, you can leave out the main clause.