Downloading the stock Kodi Media Player is completely legal. (After all, it’s available in the Microsoft Windows and Xbox One Stores. Those stores aren’t going to offer an illegal app on their virtual shelves.)
The Kodi Media Player allows users to extend the abilities of the player by installing add-ons. These add-ons allow users to stream content from various sources. Where some users get into trouble is when they download and install the wrong add-ons. If a user sticks to the official repository, called the Kodi Add-on Repository, they’ll remain totally legal.
However, third-party repositories contain many add-ons that illegally access streaming services, or that access copyrighted content that has not been properly licensed. Streaming content in this way is clearly illegal.