Why does a dielectric slab move inside the capacitor? 
The electric field is in Y direction.Therefore shouldn't force be also in the vertical direction.Also if electric field is y direction then what's the force that is pulling the slab inside the capacitor?
I am not asking to calculate the force.I am just asking what's the origin of this force
 A: If the electric field were indeed everywhere exactly in the $y$ direction then you would be correct: there would be no force in the $x$ direction. So I like your question. But in fact the statement that the electric field is in the $y$ direction is an approximation. It is exactly true in the centre of a symmetrical capacitor, and it is close to true inside most of the capacitor when the plates are close. It is also true at points in the plane half way between the plates, whether inside or outside the capacitor.
But outside the capacitor and away from the plane of symmetry the electric field is not vertical. It loops around from one plate to the other, so at most places it has a non-zero $x$ component. This non-zero $x$ component produces the force on the dielectric. (The field polarizes the dielectric and then pulls on the charged surfaces that result).
A good exercise is to sketch the field lines outside the capacitor, and note the signs of the surface charge it brings about on the dielectric. Then you should be able to confirm that the forces do indeed pull the dielectric in rather than push it out. 
A: A dielectric material might contain dipoles (molecule compounds and the like of non-symmetric charge-distributions). They effectively have a positive and negative end. They will not move, but can rotate.
The electric field aligns those dipoles, meaning they will rotate so that their positive ends point towards the negative plate - and thus attract it - and their negative ends point towards the positive plate - and thus attract it.
Let's imagine that the above-plate is the positive one, and the below-plate is the negative one.
In between the plates, the field lines are perpendicular. The dipoles align with the field lines and also point perpendicularly.


*

*Their positive ends are attracted directly downwards

*and their negative ends directly upwards.


As a whole, the attractive electric forces cancel out so the material as a whole won't want to move perpendicularly.
Now, what about the dipoles outside the capacitor, that are close enough to feel the electric field lines? They will also align. 


*

*Those on the lower half of the material will have their positive ends tilted downwards/rightwards (directed towards the negative plate).

*Those on the upper half of the material will have their negative ends tilted upwards/rightwards (directed towards the positive plate).


The upwards and downwards parts of the attractive forces are again opposite and cancel out. But the two rightwards parts of the forces are not opposite. They add up.
In conclusion: There is no net y-directed force. But there is a net x-direction force, towards the capacitor.
