Durpal 8 on install new module, insert data in new created table
To run tasks when your module is installed, use hook_install(), e.g.

function module_install() {
  \Database::getConnection()-&gt;insert(...)-&gt;execute();
}