You can get cases just by playing CS:GO, whether it's a competitive game or not. You can also buy cases (most of them are really cheap, usually 0.03$).
To open them you need keys, and that's the only thing you actually need to buy, and each key costs around 2$.