To answer this question let's remember the definitions of the mean and the median.
The mean is defined as the sum of all the values is the data set divided by the number of values we have in the data set, that is:
On the other hand, the median is defined as the central number of the data set, that is, it the number that divides the ordered data set in two subsets of equal length.
From this definition we conclude that the mean is more affected by outliers; this comes from the fact that for this central tendency measure we need to add the values and hence the outliers will affect this sum.