Question: I understand that Exchanges facilitate exchanging cryptocurrencies between fiat currencies and other cryptocurrencies, but how do they relate to the actual blockchain? When a trade occurs on the exchange, is it recorded in the blockchain?
No, it does not. They simply record the trades from every user and update each users balances according to the trade that happens on the platform. Transaction will show up on blockchain only if user made deposit/withdrawal.
For context, I've been looking to try algo-trading Bitcoin for fun. I understand there are highly skilled individuals already doing this and will likely make either no profit and/or lose all my investment, but I'd like to dabble in a little programming and trading to learn. I've been watching the Bitcoin and Cryptocurrency Technologies Online Course on Youtube and have purchased a Ledger Nano S. Any advice or recommendation in terms of good resources to look at would be much appreciated.
If you mean algorithmic trading, you probably can use Gekko.[1] It's open source, and you can make your own trading strategies. It also supports several famous exchanges out there. If you look for paid services, then you can use GunBot, FoxBot etc.
[1]
https://github.com/askmike/gekko