ChromeOS is able to show terminal in the browser because the feature is built into the browser. i.e terminal extension (crosh extension) on ChromeOS has special privileges to access the underlying system.
if you want to dig deeper (grep for terminal_private_api here):