Randall wanted a unique short string associated with all his work. That way he could Google "xkcd" and find everything he ever did online. I believe he had a script that generated all possible 4-letter combinations and filtered out ones with any search results, and settled on "xkcd". But he became a victim of his own success when the comic became so popular and "xkcd" is now synonymous with the comic.
Source: talk by Randall, might be this one but I'm not sure: https://youtu.be/zJOS0sV2a24.