Embedding code in Joomla can be done in a couple of ways. The most common way is to use the Joomla code editor which is available as a plugin or as a part of the Joomla installation.
The other way is to use a third-party tool, such as Joomla Code Snippets.
If you use the Joomla code editor, you can insert the code directly into the HTML or PHP files. If you use a third-party tool, the code will be automatically inserted into the HTML or PHP files based on the template you are using.
The best way to find out which method is best for you is to try both and see which one works better for you.