It's an interesting question. As @Mistu4u mentioned, the formal definitions of both words are similar.
There are some differences, however:
Happen — something random to take place;
Occur — something to become observable; in a certain moment; an event or a process;
The difference is even more evident if you notice that occur is relative to current as they both came from Latin currere "to run".
So, I would use occur in the following contexts:
...and happen in the following contexts:
- Informal context;
- Rough time or place;
- Random events, usually without being planned;
As usual, you can step off these recommendations if you need to convey your attitude about what you are speaking about.