Animate Objects a 5th level spell should allow you to do this for 1 minute at a time.
My gnomish Wizard loved to beat people up with flying gold coins
Tiny Servant a 3rd level spell from Xanathar's Guide to Everything is another way to animate a tiny object for up to 8 hours.
Awaken a 5th level spell costs 1000 gp and is instantaneous. It can awaken a bush(bring me a shrubbery!) or a tree allowing it to move on its own. It is only charmed by you for 30 days.
Create Homunculus a 6th level spell from Xanathar's Guide to Everything turns blood, clay, ash and mandrake root into a special construct called a homunculus found in the Monster Manual.
True Polymorph a 9th level spell is yet another way to animate an object. however it does lose its original form so while transformed it IS a dragon not a house or castle and must be CR 9 or less. If you make this permanent it is no longer under your control.
and as always Wish a 9th level spell can do this as well.
Shield Guardian Amulet or a Figurine of Wondrous Power maybe what your looking for if you want a longer term companion. The Shield Guardian Amulet is found only in the Monster Manual (under Shield Guardian) though so you'll need to ask the DM for it. The Figurine of Wondrous Power comes in many forms (the Bronze Griffon is really nice) and is found in the Dungeon Master's Guide and may be available for sale somewhere.
Manual of the Golems is another expensive time consuming yet permanent way to animate an inanimate golem. It uses anywhere from 30 days and 50,000 gp to 120 days and 100,000 gp and consumes a very rare magic item, provided you have a spell caster with 2 5th level spell slots available on a daily basis.