... What I don't get is why does the particle behave like a wave when unobserved and like a particle when under observation?
...
Physicists tend to (or should) leave the "why questions" to philosophers and focus on the how and what questions. By "observed" I assume you mean made a "recordable interaction" with larger matter.
For example cause a silver halide (iodide?) crystal in a photographic film to undergo an internal change, which if two photons hit that same crystal will become a stable change for many weeks.
If unpolarized light beam is directed towards perfect polarizer, half will pass thru and have their electric field now aligned with the "pass direction" of that polarizer, which we can confirm with a second perfect polarizer but we are not observing their electric field rotate to the direction of the polarizer's "pass direction." - We are inferring that it did, if not by chance already so aligned.
I.e. we never really "observe" the photon as a wave, but infer that it is from what it can do. The two most important things it can do for this inference are both exhibited in the double slit experiment. *
A large number of them will make a wave's interference pattern than can be seen when the film is developed. Also, because this interference pattern can be made with long exposures and an extremely weak light source, so weak that most of the time not even one photon exists, we infer that EACH photon in some sense goes thru both slits. Each photon interferes with itself!
No thing we want to call a "particle" can do that - be at two different slit locations at the same time. Note we did not actually observe that the photon went thru both slits, we inferred that, from the fact the two silt interference pattern was still produced with this very weak light source.
SUMMARY: We only observe the photon as a particle. We infer it has the characteristic of a wave from what it can do when it is not being observed (as a particle). If observed, it always acts like a particle.
----------------
* The two slits are not far apart, but one can also make the interference pattern with a two path interferometer with very weak light source. In this case large part of the two paths EACH photon travels can be separated by meters - I don't think there is any limit except practical ones of aligning the "half silvered" beam splitters, avoiding absorption, etc. I.e. one path, in principle to go to the moon, be reflected by a mirror there and then return to Earth. The other path would need to be highly folded by many mirror reflections to make it essentially equally long. ("Essentially" as the difference in path must be significantly less than the length of the photons.)**
**I have used a two path interferometer to measure how long some photons were. Mine were about 30 cm long. - I.e. with path difference greater than that, the interference pattern has completely faded away to a uniformly illuminated screen - the "head" of one arrives at the screen after the "tail" of the other has, so can not interfer with itself.