There are a number of ways in which the JLS allows sloppiness. Order of modifiers, for instance. Probably the worst offence is indentation, although that is not reasonably handlable by the grammar.
A particular problem with class names is that, IIRC, it is not clear in the grammar which identifiers are class/interface names and which are not. Strictness at declaration points is possible, but then it makes the rest of the grammar more complicated.
Probably it comes down to time pressures. And even back then, Java was considered bossy. People where busy writing C and C++ with all sorts of conventions (typically different from libraries) causing all sorts of confusion, but they didn't seem to care.