First and foremost a “plugin” differs from “script” in the level on integration and how it is installed and initialized by Maya.
For example you can create a plugin with Python that will show up in Maya’s “plugins” window, and you can Load and Auto Load it. On the code side of things you need to define functions that will run when plugin loads and unloads. You can choose what happens, but generally it’s a good idea to unload your plugins’ modules from memory on unload, remove menus, etc. And when it loads you create your plugin’s menus, load modules, do all the initializations you’d like.
And in general when using plugins it’s used with a python “project”, not a single file. But it can be just a single plugin.py file as well.
Other than that “a plugin” is no different from a script. There are no additional benefits. The way you could get ‘deeper’ into Maya is not by using plugin vs script, but by using OpenMaya API instead of cmds. It’s a C++ API directly exposed to Python.
Now, there’s also another side to this coin - C++ plugins. Again, I don’t think there’s anything you can do with a C++ plugin that you could never do with Python, but C++ would give a significant performance boost to computation intensive opeartions. For example if you’re writing a mesh deformer, or if you want to write your own physics engine - you can do that in Python, but it would work a lot faster if it’s written in C++.
Often it’s a combination of the two. You may write computation intensive parts in C++ and the rest in Python.
The downside is that if you plan to distribute your plugin - you have to compile separate versions of a C++ plugin.mll for every Maya version, for every OS. So even if you follow Autodesk’s Maya version support scheme (3 or 4 latest versions), it’s 4 * 3 (Win, Mac, Linux) - 12 versions of the plugin you’ll need to compile. The sane way of doing it is to use a CI\CD system, like GitHub Actions with a few build machines, virtual or physical. Doing it manually for every release would be a lot of work. And plugins also often tend to extend support for older versions, because you can still find studios using Maya 2016, for example.
As for where to learn it, oof. I hope someone else can point you towards a good resourse about it, I learned it over the years from a resource called “The Internet” haha
But you can definitely get all the information you need from Maya’s Developer documentation, for example here: Help
While it may not be presented in the most digestible way for a newbie, it contains everything you might need to know about writing plugins for Maya.
For example here’s the part about initialization and uninitialization functions: Help
And here is, quite literally, the answer to your question: Help