Shift Register 74HC595 circuit working weirdly
I presume that you are referring to this tutorial, and this code.

The clockPin of Arduino should be connected to pin 11(SH_CP) of 595, dataPin to pin 14(DS), and latchPin to pin 12(ST_CP).

Swap the values of clockPin and latchPin in your code, and you should be good to go.

// SH_CP; 11
const int clockPin = 10;
// DS; 14 (not 15)
const int dataPin = 8;
// ST_CP; 12
const int latchPin = 9;