Yes exactly! Kings used to live there. So much history, I would totally recommend reading about this place before going and taking a tour with a local guide to be able to appreciate the wonders of the palace.
The Alhambra was so called because of its reddish walls (in Arabic, («qa'lat al-Hamra'» means Red Castle).
Source: AlhambraDeGranada.org