Is there a formal terminology for the variable in the columns and for the variable in the rows?
The names row variable and column variable work fine for me, if indeed names are needed at all. It is perhaps more common, and typically more helpful, to refer to the names of the variables (gender, tree species, enjoyment of movie, attitude to some proposal, or whatever). Which is presented in rows and which in columns is immaterial to the analysis of contingency tables. It's just a matter of which presentation is easier to produce and to read.
If one is a response (outcome, ...) and the other a predictor (covariate, ...) you can always say so. But often the response is the count or frequency itself, as given in the cells of the table, and the margins represent predictors.
Broadly, which variable goes in the rows and which in the columns is a matter of convenience as much as logic or even convention. It is common advice that it is easier to read down columns than to compare across rows.
In practice, however, the shape of the table can dominate decisions. For example, a 2 x 20 table (say) is usually going to be shown as 20 rows x 2 columns, regardless of the contents or meaning of the variables. That applies to displays online and to those in print. (No talk should include a 2 x 20 table....)
The question refers specifically to two-dimensional tables. There does not seem to be much agreement on, or much need for, standard terminology for third or higher dimensions of three- or higher-dimensional tables, which are often best presented otherwise in any case.