This is because the semiconductor in the picture is in thermal equilibrium (the fermi-level is constant with regards to x-y-axis).
In a p-type material the fermi-level is closer to the valence band than to the conduction band and the opposite is true for n-type materials. When these are drawn in thermal equilibrium the result is an image like the one you have posted above.
The image above doesn't really give energy levels in the sense that you're asking but rather show potential difference. Given the two different materials they accumulate positive and negative charges respectively. As we know, when we interface these two materials carriers drift into the other material in an attempt to achieve charge neutrality, this manifests itself as a diffusion current and a potential difference.
The actual energy levels of the materials is given by the vacuum-function ( i know this has a proper name but i can't remember it at the time ) which is essentialy the energy-difference relative to an electron at rest unaffected byt he material ( e.g an electron in vacuum ).
TLDR; The semiconductor above is drawn in thermal equilibrium, as a result of this (the fermi level being constant throughout the material) the p-side appears to have bands at higher energy levels.