It would help a lot to know your crank brand and model and how many gears your bike has (to further narrow down your model).
The past few Shimano hollow drive-side crank arm generations are known to separate and they might crank first.
Try checking the chainring bolts. Sometimes these are located on the back side of the crank arm. They need to all be tight. There should be a light coating of grease on all the interfaces between the chainring, crank and bolts. If your chainring has ever been removed it’s likely it wasn’t greased properly. If I’m doubt, regrease and reassemble.
Other likely culprits are bad bearings in the pedals, bottom bracket, or rear hub. It could also be the cassette, free hub pawls, seat, seat post, frame, etc. There’s a near endless possible causes.
You really have to closely inspect the bike and do trial and error, eliminating as many potential root causes as possible. I would suggest removing your chain (from the chainring, it can stay on the bike) and trying to recreate the noise while standing on the pedals (hold onto a poll or doorway). If you can get it to make noise then, then the root cause is likely in the crank or bottom bracket or frame.