Why isn't that guitar in tune?
You may not be able to get that guitar in tune because it isn't possible. Most of us don't notice anyway, but it's comforting to know that you're not necessarily incompetent if you can't ever seem to get your guitar to play perfectly in tune in every key - since it can't really be done.
Let me start off by saying that No Guitar Will Play Perfectly In Tune EVER. The tempered system of tuning upon which guitar fret placement relies on is imperfect, but it’s the best we can do. The system was designed by J.S. Bach in 1717 and first demonstrated on his work The Well Tempered Clavier. Before Bach’s tempered tuning, fixed pitch instruments (keyboards, instruments with frets, etc.) were designed to play in one key at a time. If you needed to play in a different key, you’d use a different instrument or completely retune the one you had. Bach’s system redesigned the relationship between all of the notes so that the octaves in all keys would be an octave apart. In order for this to work, all of the notes in between the octaves had to be slightly out of tune. For folks with good ears, nothing played on a guitar or piano really sounds in tune. - Scott Freilich, Top Shelf Music (hyperlinks are mine)