Is it good practice to use wpdb->query() function?

If you look a bit into the source, you’ll see that $wpdb->insert() will use ->query() under the hood. So should be the same, right?

Not that simple. It doesn’t just use ->query() but also ->prepare(), which is considered best practice. Meanwhile with your code example you’ve probably just opened yourself to SQL injections.

The takeaway here: If it is a simple operation and the ->insert() etc. method work – use them. They’re tested and contain little risk. Writing your own queries always carries the risk of opening yourself up to troubles such as SQL injections.