Mean deviation is minimum while taking the deviations from median. Then, why do we take sum

of square of deviations from mean while calculating the variance?

Deviations from mean are used for variance because sum of squares of deviations from mean is minimum.