(-1,2) are all number between -1 and 2, but not including -1 and 2. [-1,2] however are the same numbers, but including -1 and 2. Slightly different sets, where the former is open and the latter is closed.
Another way to think about it is for any point in (-1,2), we can find some number that is "closer to the boundary" but still in the set. This is not true for [-1,2] if we pick -1, because any number below -1 is suddenly outside the set. -1 is a boundary point, and therefore that side of the interval is not open!
Why do we need this? Well, lots of calculus is about sequences that converge in smaller and smaller distances. One can for example define whether a function "jumps" by checking whether the inputs have boundary points or not (etc.).
But for math people, this is not general enough, because it requires things like distances. Hence, they have a more general definition: There's a collection of stuff, and open sets are sets of this stuff that follow some rules.
Now here is the important part: Closed sets do not have an extra set of rules. Instead, they are just defined as the complement (or opposite) of an open set.
So R - the set of all real numbers - has a complement which is the empty set. The opposite of "all numbers" is nothing! Since R is open, by definition, the empty set is closed.
Cool. But then, if we take our rules, we see the the empty set is also open. Whoops. Then, again by definition - the opposite of the empty set - which is R, so all numbers - is closed.
Confusion conclusion: Both R and its complement, the empty set, are both closed and open at the same time.
Note that sets are always closed or open relative to some other specified (often implied) set S.
In some courses, a closed set (in S) is defined to be a set which is the complement S-T for some open set T. In others, a closed set (in S) is defined to be a set which contains all its limit points (in S). And then whichever isn't the definition gets proven as a theorem.
The misconception is about not knowing that the generalization to arbitrary sets has some unexpected properties.
(Half-open intervals are neither open nor closed, by the way)