Plagiarism is defined as the act of taking someone else's work and passing it off as your own. If you take someone else's painting and say you painted it, you're plagiarising that work. If you copy an image of a painting online and put it on your website claiming it's yours, again you're plagiarising that work. Similarly, even if you draw or paint over someone else's work or add things to it here and there, it's still plagiarism
It's worth bearing in mind that plagiarism is illegal if it affects the artist's intellectual property rights. If your artwork is protected by copyright or trademark, you as the owner of that copyright or trademark could take someone to court if they were found to have plagiarised your works. If someone is found to have made a substantial amount of money from plagiarising copyrighted works, they could find themselves facing a fine and a hefty jail sentence.
Of course when it comes to art, it's practically impossible not to borrow ideas from pieces of work you've come across before. If you see a piece of art, you might feel inspired it and you might want to create a similar piece: that's totally fine, so long as you don't blatantly copy it.
If you've felt an inspired by a particular painting, make sure the painting you create is original and is yours. Don't recreate someone else's work. If you feature things that are clearly taken from another painting, it's vital that you reference this other painting and its artist, just like you would reference a quote for an essay. Don't cheat people into thinking something is yours when it's not. You won't get anywhere if you plagiarise. Sometimes artists want to use a part of someone else's work in their own work. Is this okay? It is, only if explicit permission is obtained from the original artist. If the original artist says you can use part of their work in your own piece, then you can. If the original artist doesn't give you permission, you can't.
So what's the best thing to do to make sure you don't plagiarise? Simple: be unique. By all means look at other works for inspiration, but when it comes to creating works of art for yourself, create pieces that showcase your talent, vision and individuality, not someone else's. If you do plagiarise someone else's protected work, they will find you and they will take action.
When you create art, you wouldn't want someone else coming along and ripping your work off, plagiarising it and passing it off as their own. You wouldn't want your work plagiarised, so don't plagiarise the work of others. There's quite a fine line between being inspired by something and plagiarising something, so if you're unsure, it's always best to make a reference just in case. The best thing to do, of course, is to carry on being original.