Is it possible to enable and disable wp debug from functions.php?

You could, but you wouldn’t be able to debug anything that happens before the theme is loaded. This includes most of WordPress loading and all plugins loading. You need to put it in ‘wp-config.php` so that it’s set before anything happens. Also, global debugging is not something themes should control. It’s not appropriate, even if it worked.

tech