I'm told to install ubuntu on my laptop for work in order to learn shell scripting.
You can also probably make do if you install Cygwin, but you will have an emulated Linux environment and not a real one. For just learning about shell scripting it may not matter, though.
I've read the best way is to install ubuntu on a USB stick and partition my HDD. I'm curious how an OS is bootable from a USB stick?
BIOSes simply ask a boot device for sector 0, put it in memory somewhere, and then run what's there. As long as they know how to ask the boot device for that sector (early BIOSes only worked with floppies and have gradually learned about other devices such as CD-ROMs and USB drives over the years), it's all the same. As long as sector 0 of the USB drive has a valid bootloader and partition table most BIOSes can boot from it (you may need to bring up a boot menu with F12 or something like that during boot).
UEFI is a bit smarter and actually loads a file from a partition on a device, but as long as UEFI knows know to do that with a device, it doesn't care about the kind or type of device.
Is it literally just a small interface that can be put anywhere?
Linux is very versatile, it can run read-only from a CD-ROM, directly from a portable drive, from a hard drive, from flash, and other weird possibilites. You can guarantee that if someone has needed Linux to boot in a strange way that it's possible and has been done. The original Xbox-hacked Linux installer actually ran Linux from a large file mounted as a loop device.
he told me it will run slow if I don't install it and only run it from the usb, is this different from running ubuntu from a usb?
He's right. USB drives are slower than internal hard drives (CD-ROMs are even slower). However, if all you are doing is running the shell in Terminal or learning about Linux, it'll do.