If you have come through a Python background, you would see gemspec file very similar to setup.py file. Actually, both have the same purpose which is to build, install, and distribute Python packages/Ruby packages (gems).
The simple definition is each programming language has packages and your project relies on it. But, in turn, these packages have come from somewhere and someone. Those who write those packages will have to define gemspec file in order to distribute for other developers or community to use it.
In a nutshell, gemspec file bundles a project into a package.
Note: If you don't want to distribute your project as a package then you don't need gemspec file.