I live in MD but work in DC. MD taxed me but DC did not. Do I file for both?

I only earned income in DC not MD, but MD withheld my wages for taxes and DC did not.  Do I file for both? If I do file for DC, do I put in a non-resident request for refund, and if so, what do I put in it, when nothing was withheld?  And why did MD withhold taxes when I did not earn money in that state?