The Fermi level is based on the probability of finding an electron at a particular energy level - the theoretical energy where the probability is 50%. In an n-type material there are additional electrons that fill the conduction band. This means that the energy at which you have a 50% chance of finding an electron is increased, closer to the conduction band. The opposite is true for p-type materials, which have electrons removed (or additional holes).
For your first question, in order for the p-type side and n-type side to be at equilibrium, i.e. in an unbiased state, the fermi level must be equal across the junction - so the p-n junction forms around the constant value of the fermi level. As soon as you bias it, the fermi levels can split and allow current flow. The Fermi level position in both materials therefore determines the extent of the band bending and, once biased may affect parameters like the voltage available from the junction.
I hope I've answered the questions you had, I'm happy to add additional clarifications if you'd like.