When a photon with the appropriate energy hits an atom, the electron will make a transition from the ground state to a excited state. This will make the potential energy of the atom higher.
This is mostly correct, but it's not the potential energy of the atom which is higher, it's its internal energy
Also, momentum is conserved,
this is correct, but
and the velocity of the atom will change in the opposite direction from the incoming photon.
this is the wrong way round. The photon momentum ($h/\lambda$ in the direction of propagation) is absorbed, and this will increase the velocity of the atom in the direction of propagation of the photon
When the electron returns back to it’s ground state, a photon is emitted in a random direction. Again, momentum is conserved and the velocity of the atom changes in the opposite direction from the emitted photon.
This is correct, and indeed it is the basis for Doppler cooling.
I am a bit confused because if that's the case, the atom will gain kinetic energy and therefore will gain thermal energy. Doesn’t that violate the conservation of energy?
Gaining kinetic energy does not mean that it will gain thermal energy $-$ kinetic energy is only thermal energy when it is in randomized directions. You can have objects which are very cold but moving very fast, ranging from ice cubes fired from a potato cannon all the way to atoms in particle accelerators with a high velocity but a thin velocity spread.
That said, the photon kick to the atom's center of mass does not mean that energy is somehow non-conserved. Instead, if the final state of motion (after absorption of the photon's momentum) has a higher kinetic energy than the state of motion before the photon absorption, this energy deficit is provided by the photon: in other words, the transition frequency gets blue-detuned, and the photon's energy needs to provide both for the change in internal energy and the change to the center of mass's kinetic energy.
Since the energy is already conserved by absorbing and emitting a photon with the same wavelength.
There is no requirement that the wavelengths of the absorbed and emitted photons be precisely equal, and in general, if absorption-then-emission cycle changes the center-of-mass motion, the two wavelengths won't match. Again, this is what powers Doppler cooling.
I've written up the details of how this looks like within the framework of quantum mechanics at How does one account for the momentum of an absorbed photon?, though that thread might lie outside of what your background allows you to tackle in full for now.