DC to AC using PWM or Analog pins

Is it possible to generate a sine wave that mimics an AC current using a microcontroller instead of using an inverter?

If it is, can you point or link me in the right direction or with code to follow?

You can use PWM, it outputs a square wave. Running that thru some filtering will take the squareness off the corners and make it more sinewave like.
Do a search for “arduino pwm secrets” , you will find some good writeups on changing the frequency.

You can also do it without PWM, search for my recent post “piano tones micros” on blink without delay style of programming to do that.

bradley:
Is it possible to generate a sine wave that mimics an AC current using a microcontroller instead of using an inverter?

That depends on how many amps you want from it.