Politics may answer the “why” part.
From my FB friend who lives in Ukraine when I asked him his opinion:
“Separatists with a weapon supplied by Russia. And I believe, with some doubt, they thought it was a military target. Big mistake. Nonetheless, it is what it is and Russia is responsible for providing such a weapon to them. Civilian airliners give off signals to the ground that are peculiar only to passenger planes. Either the shooters ignored the signals or didn’t understand them.
Another possibility is that trained people purposely did it to try to cast the blame on Ukraine. The Soviet playbook would be involved.”