I have a large dataset. I split the dataset into two parts (red and blue) and charted their density plots and medians (dotted lines) using R. Even though the density plot of the blue variable is farther to the right, its median is to the left. I removed outliers (defined as any observation that is more than 3 standard deviations away from the mean).
This does not make sense to me. Is this possible or have I made a mistake somewhere?

Comment continued: Here are two moderately large samples from the same normal distribution. In one sample the mean is larger than the median and in the other the median is larger than the mean. There's about a 50:50 chance that such a disparity would occur by random chance.
As is characteristic of moderately large normal samples, both have some boxplot outliers in both tails. Deleting those might make the difference between mean and median larger (mostly by changing the sample means).
Note: With long-tailed symmetrical distributions such as Student't, Cauchy, and Laplace, the mis-match between sample means and medians might be even relatively larger. For example: