Car sways

my 2002 hyundai sonata drives fine but when i drive it on poth holes or rough roads, the car sways.

can anybody tell me what the problem is?

A check of the front suspension by a qualified mechanic can answer that. Sure we could guess tie rods, sway bar links, bushings, rack and pinion problems etc. so no we can’t.

Please define “sways.”

Be as descriptive as you can.

How many miles? Could need shocks/struts by now.

In addition to all of the other good recommendations suggested, check your tire pressure. Too high a pressure will cause “skipping” on rough roads. That can make a car seem to wander.