The while is setup so that you provide a conditional, and then you provide a single statement that includes what you want to do. The syntax of the while requires that the condition go inside parentheses, and that the statement comes after that. Since the semi-colon indicates the end of a statement, your first piece of code does nothing in this "what you want to do" part.
In most cases, you want to have more than a single statement be repeated by the loop. In that case, you use a compound statement, or a block. The braces indicate the block. A single block counts as the single statement in the "what you want to do" section of the while. So this:is the same as this:
The mistake people make is they do this:
The problem there is that the semi-colon ends the single statement that you are allowed to have with the while, and the block that comes after it is not included in the loop.
// more statements
So in the end, the semi-colon is still just an indicator of the end of a statement. The reason you don't put it after a while is because the condition part doesn't require a semi-colon to indicate where it ends, and if you put one there, it will indicate the end of the "to do" part rather than the condition.