Yup, you accidentally discovered Exposé. It's actually a pretty neat feature. If you have some stuff open but need to access something on your desktop without closing or hiding all your windows you can do Exposé: show desktop. If you have several windows open and they're overlapping, and you want to see them all side by side at a glance, do Exposé: show all windows. To do the same for only windows belonging to a particular application, there's a button for that too. They're customizable from that system preference pane and you can probably change the keys or disable them if you keep accidentally pressing them, though you should know that it can be really handy when you learn how to use it.