This is largely an arbitrary choice. One language did it some way, a long time ago, and then many but not all other languages copied a familiar syntax. That being said, the choice is not completely arbitrary. Putting the type before or after the variable name is largely cosmetic, but there are more differences than this between the C-style syntax and the Pascal-style syntax used in languages like Rust and Scala.
In early languages where variable declarations had a type, the syntax of a declaration was of the form
Type Name where
Type is a reserved word and
Name is a name chosen by the programmer. Here the order is not arbitrary: first you say what kind of thing you're declaring, then you give it a name. Compilers at the time were very primitive and needed to know early on what they were parsing; writing
INTEGER X let the compiler know immediately that it had to work on an integer declaration, whereas
X INTEGER would have required the compiler to first remember that it had seen
X and only after that it would have known that it was supposed to declare an integer variable. Languages of the 1950s and 1960s such as ALGOL and FORTRAN tended to use this syntax. Interestingly, at the time, in programming language descriptions, “type” had a more general meaning that it has today: today it has a specific technical meaning that's more or less synonym with “datatype”, but at the time it had its ordinary English meaning, which could cover things like integer and real, but also things like label and statement.
C extended this syntax in a way that allowed defining compound types. In C, the syntax of a variable declaration mimics the syntax of its use. For example,
int x declares an integer called
int *p declares a pointer-to-integer called
p, and the expression
*p has the type
int. This syntax is not purely prefix because accessors can be suffixes: for example
a is an
a is an array of
int values, so the syntax to declare an array of integers is
C became a very popular language, so many languages after it retained a similar syntax for several things including variable declarations and types.
The colon syntax goes back to at least Pascal in 1971. This is the syntax used by computer scientists at least since the early 1970s. I suspect that it started in theory papers and was adopted by Pascal and later by other languages, but for all I know it may have originated with Pascal. Why colon to denote that a value belongs to a type? discusses the origin of $x : T$ in computer science. Modern languages that draw from modern (or not-so-modern-anymore) theory tend to use the syntax that's familiar to computer scientists, including ML, Scala, Swift, Rust, and many others. Haskell is somewhat unusual in using a double colon
:: where others use a colon
The order $x : T$ vs $T : x$ is arbitrary: these days, compilers don't mind, and for humans, it's just a matter of habit. However, having a punctuation sign between the variable name and the type is not arbitrary. Most languages that use this syntax also allow the left-hand side to be an expression, to form a type annotation. More importantly, the right-hand side is a type expression, not just a type name. Recall that C supports declarations of variables with compound types, but the syntax is somewhat awkward, with the variable name ending up somewhere in the middle. C's syntax does not work with compound types that are made of more than one type part. For example, in ML,
x : bool * int * string means that
x is a triple consisting of a boolean, an integer and a string. Haskell writes this
x :: (Bool, Integer, String). Both the ML and the Haskell way allow building complex types. The C approach fails: where do you put the variable name?
Languages such as Java and C# deviate from the C syntax by putting the whole type information before the variable name:
(bool, int, string) x,
List<int> v. With no separator, it's impractical to allow both sides to have an arbitrary length, but these languages do support type expressions, which can be used to declare a variable.