No. You don't have to buy a new computer. You should however, be budgeting for a future Mac purchase if you want to stay current with macOS. Your iMac is capable of being upgraded to macOS 10.15.7 (Catalina) which only supports 64-bit applications.
If you are dependent upon 32-bit applications (e.g. Pages '09, iPhoto, Aperture, iMovie '09, MS Office 2008/2011, etc.) these will not work on Catalina. You can confirm what other 32-bit applications you have via the free Go64 application.
You can get macOS Catalina (or Mojave 10.14.6 that still supports 32/64-bit applications) via the following link using only the Safari browser. There will be links to the appropriate operating system download in the Mac App Store which will install into your /Applications folder.
How to get old versions of macOS - Apple Support
It is strongly advised that you perform a Time Machine backup of your macOS 10.9.5 operating system and user data before any upgrade, and then do not reuse that drive for the newer operating system.
Note: If you are using Pages, Numbers, or Keynote on macOS 10.9.5, after you backup your Mac to a Time Machine drive, I would remove these applications prior to the upgrade. After the upgrade, you can launch the Mac App Store, sign-in with the same Apple ID, and click the blue cloud icon for each of Pages, Numbers, and Keynote. This will present a dialog offering to install the last compatible version (11.1) of these applications into Catalina, or if you stopped at macOS 10.14.6, the last versions for it.