How do I fix grainy and chewy caramel corn?
Splitting your problem down to the two issues.  Though they could be entirely related

1: Grainy
2: Chewy

Let's deal with the first - grainy.  How are you melting your sugar (I am assuming you are using brown), are you adding corn syrup?  Perhaps you have some granules of sugar that are 'un-melted'.  It could be that your corn syrup (if used) is reacting in some way.  

Now to the second - chewy.  Try heating your sugar syrup for a little longer.

I hope that this helps.  Below is a great recipe which might help.

Classic Caramel Corn