why capacitors are used with crystal oscillator?
can anyone please explain why capacitors are used


Firstly, a typical circuit is shown below and on that circuit is marked phase angles to roughly achieve oscillaton: -




The inverter provides 180°
R1 and C1 provide about 10°
The crystal and C2 provide a further 170°


If you didn't have capacitors you wouldn't get a total of 360 degrees phase shift and that means it wouldn't oscillate. If you use a simulation tool and model the crystal you will see something like this (below). This is the combined added phase shift brought about by changing C1 and C2's values: -



The blue horizontal line marks the "added" phase shift of exactly 180° - this would be the point of oscillation. Anything below 10 pF probably wouldn't oscillate so, you need the capacitors to make the overall phase shift around the loop add up to 360°.


  and why those 22pF?


Well there are oscillators that will need more and some that will need less. The XTAL data sheet normally indicates what value is required.


  how they calculated?


You need to observe the recommendations in the data sheet and also consider the added effect of gate input capacitance.

Related answer and also Designing an oscillator.

The bottom line is that an oscillator will only oscillate if the phase shift is 360° (or 0°) and there is enough gain (greater than 1) around the loop.