By default, any well-behaved source code package will install itself in /usr/local instead of touching anything else in /usr. This is because /usr/local is meant for local additions by the system administrator, to avoid changing and conflicting with files installed by the package manager (in this case apt).
You should never modify and create files anywhere else in /usr. There's a lot of bad advice online, including the tutorial you've followed. In almost every case there's an equivalent to a /usr directory in /usr/local that will complement (and override) the other. For example, /usr/local/bin complements /usr/bin.
Now with this knowledge, how do we remove manually installed software from /usr/local? It depends.
In general, it's safe to remove the directory as a whole, if you know that you don't want to keep anything you installed this way. apt never installs things here, so this should not break anything, though it is wise to back it up.
If there's things you want to keep, you will need to inspect the directories yourself, and play the role of package manager, looking for files belonging to the program. Usually it's not hard to figure out as they will be named accordingly. For example, to delete all manually installed versions of python3, you could accomplish it with the following commands:
rm -r /usr/local/bin/python3*
rm -r /usr/local/lib/python3*
rm -r /usr/local/lib/libpython3*
Additionally, the instructions overwrote the symlink in /usr/bin/python3.9. It's wise to reinstall python using apt instead of removing that file - if it's required it will be updated by the package manager.