Its a bit of both.
The web server software works out if the page is a php script, and sends it to PHP to process if it is. PHP then parses the code, and anything inside <?php ?> tags gets compiled and evaluated. Anything outside those <?php ?> tags is treated as ordinary HTML.
So...
<b>Hello World</b>
<?php
echo "<b>Hello World</b>";
?>
HTML and PHP in one script.