It seems to me that Turkey tried to stop Russia from attacking the Turkmen rebels near its border. Turkey had protested about such attacks a few days before this incident in vain. But Turkey's attempt backfired badly with Russia having escalated its attacks at the border, a Turkish aid convoy was hit without that generating much of an outrage in the international community.
Then given that the Turkish shoot down of the Russian bomber has moved Turkey a lot farther away from implementing its agenda (protection of the population on Northern Syria using safe areas, setting up a no-fly zone there etc. etc.), one can ask why Turkey went about shooting down the Russian bomber, given that the violation of its air space was rather minimal?
I think that Turkey miscalculated the support it would get from NATO. While NATO formally accepted the Turkish perspective on the incident, it called for a de-escalation of this conflict. Britain has said that Russia and Turkey should discuss this incident. That's a rather muted response, it probably falls way short of a very strong condemnation of Russia that Turkey had hoped for.
So, instead of moving closer to a situation where Russia is more pressured to stop it's military attacks on non-ISIS targets, Russia has dramatically escalated such attacks. Also, Russia has announced that it will install the S-400 SAM system in Latakia, so if anyone is going to impose a no-fly zone it will likely be Russia.
Turkey has thus played the card of violations of its sovereignty rather badly, considering also that this was the only card left in its hands. Russia, on the other hand, has many such cards yet to play. Russia is intervening on the behalf of the Assad regime; violations by the US, France and others of Syrian sovereignty have been so far tolerated by Russia, something that Russia can always revoke in the future (when more Russian air defense assets arrive in the region) without that being an act of military aggression.
The bombing of the aid convoys is a good example. US planes would never have bombed aid convoys (consider e.g. a suspicious aid convoy near Raqqa, the US would be very careful to first verify that it's not an aid convoy, warn the drivers and take the convoy out only after multiple warnings). The US would also be legally obliged to act that way, because it is an intervention outside of its territory.
For Russia the legal situation is different, because it can make the case that the Turkish convoy violated Syrian sovereignty and was therefore justifiably taken out. Russia doesn't care about whether or not the convoy was in fact a civilian convoy or not, just that it was not cleared with them or the Syrian authorities to make sure it didn't contain any weapons for the rebels operating in the area.