Hux was the (illegitimate) son of an Imperial flag officer, one who ran a military school before the end of the civil war. Hux had a bit of a chip on his shoulder from how his father and the other old-guard officers treated him, which probably contributed to him forming a cabal (including, but likely not limited to Phasma) to depose his father and, possibly, the other Imperial veterans from leadership in the First Order and have the younger generation take over.
The specifics of how we got from Hux Senior and Rae Sloane to Snoke, Ren, and Hux Junior calling the shots in the First Order is one of the big details of the New Republic era that remains vague. TRoS has thrown a bit of a wrench into it as a story (it's now less the neo-Nazis starting by killing their own parents and more Palpatine having an internal reorganization, probably mostly out of spite), but I expect it'll shake out as something interesting in the end once people figure out how to deal with the elimination of Snoke as an individual.
The specifics of how we got from Hux Senior and Rae Sloane to Snoke, Ren, and Hux Junior calling the shots in the First Order is one of the big details of the New Republic era that remains vague. TRoS has thrown a bit of a wrench into it as a story (it's now less the neo-Nazis starting by killing their own parents and more Palpatine having an internal reorganization, probably mostly out of spite), but I expect it'll shake out as something interesting in the end once people figure out how to deal with the elimination of Snoke as an individual.