After running a
search why do I see a string of "X"s (or "N"s) in my query
sequence that I did not put there?

You are seeing the result of automatic filtering of your
query for low-complexity sequence that is performed to
prevent artifactual hits. The filter substitutes any
low-complexity sequence that it finds with the letter "N"
in nucleotide sequence (e.g., "NNNNNNNNNNNNN") or the
letter "X" in protein sequences (e.g., "XXXXXXXXX").
Low-complexity regions can result in high scores that
reflect compositional bias rather than significant
position-by-position alignment
(Wootton amp; Federhen, 1996). Filter programs can
eliminate these potentially confounding matches from the
blast reports, leaving regions whose BLAST statistics
reflect the specificity of their parities alignment.
Queries searched with the blastn program are filtered with
DUST. The other BLAST programs use SEG.