It's true that the Naxalites target the Indian armed forces but have they ever encountered the Indian Army? Not to my knowledge although it can't be ruled out in some remotely exceptional case. One may ask why make such distinctions? After all, what's the difference between the terms 'Indian armed forces' and the 'Indian Army'? Yes, there's a difference, howsoever subtle; and it's necessary to highlight the distinction because it's a technical distinction on the one hand and also a sensitive distinction on the other.
The Indian armed forces includes all the different forces that take part in the defense and security of the country, e.g. the army, the navy, the air force, the Coast Guard, the BSF (Border Security Force), the ITBP (Indo-Tibetan Border Police), the SSB (Seema Suraksha Bal), the CRPF (Central Reserve Police Force), the CISF (Central Industrial Security Force) and the state police forces among others.
In the Naxalite-affected areas in the states of Chattisgarh, Jharkhand, Orissa, Telangana, Maharashtra, and Bihar, it is either the CRPF or the state police forces that are fighting the Naxalites. Not the army. They are part of the Indian armed forces and hence it can be said that the Naxalites attack the CRPF and the state police forces and not the army. After this clarification let's now focus on 'Why' the Naxalites attack our armed forces. Honestly, it's not a simple or short answer because it's got a long historical, political, social and economic context but let's try and summarize this vast context into a reasonable abstract.
The Naxalites are communist extremists who preach a hard economic doctrine as laid down in the handbook of communist philosophy - Das Kapital was written by Karl Marx. They draw the theoretical justification for their movement from this book like all other communists but when it comes to implementation of the principles that Marx talks about in this book, the Naxalites take the extreme position of gaining power through violent revolution.
They draw their inspiration from the violent communist-led uprisings in Russia in 1917 and in China in 1948 that led to these two countries becoming communist, which meant, the communist party can be the only party in power - no opposition. They call it the 'Dictatorship of the proletariat'.
Proletariat means people and hence, the one-party rule by the communists is presented as the dictatorship of the people, so that, the rest of the world gets the impression that all the people of the country (where the communists have taken over) are partners in power. Of course, we all know what communist dictatorships are when we see North Korea or China where there is no opposition and nobody can have an opinion which is different from that of the communist party. That's the kind of system the Naxalites are fighting for and that is reflected in their violent and stubborn behavior. India as a nation has rejected this idea and our armed forces are eliminating this evil force bit by bit, from its roots.