Japanese Crab Identification?
The carapace shows the distinctive lines of Chiromantes dehaani (Kurobenkei-gani in Japanese). This species can be found quite far away from the ocean, commonly in brackish streams and rivers. The size fits your description, the width of the carapace is approximately 3-4 cm, giving the entire body roughly the same size as you observed. These crabs are also most active at night.

I have seen these crabs in sheltered areas slightly inland from the sea. Here is a photo of C. dehaani that I took in Tokyo:


While there is a slight possibility that this is Chiromantes haematocheir (Akategani in Japanese), your photo does not show the distinctive red claws and this species is less common in Tokyo Bay due to development and loss of its natural environment of mudflats. Therefore, I think it is save to identify this as C. dehanni.