그냥 and ㄹ(을) 뿐이다 has common part in terms of meaning: just
But if you study them deeply, 그냥 has the meaning of “without any reason/cause/context, (generally) just ”, while ㄹ(을) 뿐이다 means <sth is the only thing>
So it makes slight nuance difference:
어제 뭐했어? What did you do yesterday?
그냥 잤어. I just slept. (Without any context)
왜 모든 여자들이 널 좋아해? Why do all the women like you?
몰라. 나는 웃었을 뿐이야. I don’t know. The only thing I did was smiling.
나한테는 너뿐이야. To me, you’re the only one (I love)
그냥 너를 좋아해. I just love you (without any cause/ reason)
Hope this works for you.