How to insert value to taxonomy on custom form submission
To add taxonomy term in form submission, get all inputted term values and those to Vocabulary you need.

use Drupal\taxonomy\Entity\Term;
$categories_vocabulary = 'EXAMPLE'; // Vocabulary machine name
$categories = ['test 1', 'test 2', 'test 3', 'test 4']; // List of test terms
foreach ($categories as $category) {
  $term = Term::create(array(
    'parent' =&gt; array(),
    'name' =&gt; $category,
    'vid' =&gt; $categories_vocabulary,
))-&gt;save();