Well, if you generate an address and some coins were already there and you use those coins, then it's illegal.
Let's make this even more simple.
Suppose, you generate a private key and somehow it turns out to be the private key of a very large exchange. You transfer those coins to your address. Then the exchange announces that it got hacked and will take legal steps against you. So there you have it, it's illegal