There’s a fairly common idea that it takes longer to master the piano than the guitar, but this is simply a common misconception.
It really depends on what level you consider a musician to have achieved.
Learning to strum some chords may not take long, but playing the instrument correctly with a classical technique can take several years.
What makes the guitar harder, and this is particularly evident at the beginning of the learning process, is the fact that you need to be extremely precise on the fretboard right away to play clean notes.
On the piano, however, you need to hit the correct key with minimal pressure to get a clean sound.
It goes without saying that both tools are extremely technical and demanding.