Is it legal, If codecanyon is detects It, what they do for me?
You have to use items within a project - you cannot just change the name/logo/colours and sell it as is.
If you did this then the implciations could be any number of thigns from account being banned/blocked through to DMA takedown notices from the author etc.
Thank you Sir, I was never do It, I think I will add some plugins and functions and resell, is it compatible?
It totally depends on the item and even then you need to be very clear to not breach terms Regular License | CodeCanyon
I would like to add more:
If You purchase any item from envato market and customize it to sell that on envato market then it is 100% not allowed and as @charlie4282 mentioned by doing that your account will be banned permanently. If you want to use that purchased item as a part/module or want to create related product as like html to any other as like wp theme then you must have to taken written permission from your purchased item author. It is called Author collaboration and enavto has a procedure for doing this Author collaboration.