I dont remember the whole story for sure, Johnson was quite the eccentric personality, there's this channel for the weird entries in his dictionary: https://www.youtube.com/@AbsurdSamuelJohnson/
But it's probably a variant of the stone kicking story about him. https://en.wikipedia.org/wiki/Appeal_to_the_stone
So let me recite the completely accurate, historically verified dialogue of the event.
*Johnson enters the room*
Bishop Berkeley: Mind! Mind! Mind! Matter is silly.
Johnson: Fellas, what's this nonsense in here?
Bishop Berkeley: Subjective idealism my friend, so let's talk a bit more about God. Even better would be God's mind and how the existence of matter depends on how one perceives it!
Johnson: This is crazy! What the hell! I'm SO out!
*Johnson escapes in a swift manner*
Johnson: I'm so mad at idealists now! How could matter not be real? This cute kitty is not real either? Why can I do this then, huh?!
*Johnson manages to kick Hodge the famous fluffy kitty because it seemed like an actual argument in his MIND*
Johnson: Idealists are so pwned now!
*Berkeley giggles in the distance and is not pwned at all*
*Fluffy cat cries in cat*