毎【ごと】に means "every", so
2日ごとに is "every second day".
On the other hand,
X置【お】きに literally means "leaving (an amount of time/space/...) X (between each occurence)". It comes from the verb
置く, "to put", "to place", "to leave (sth. somewhere)".
Here is an article from NHK's 身近なことばの疑問にお答えします about ごとに and おきに.
So how come
おきに sometimes means the same as
ごとに, and sometimes not? Let's think about English for a moment, the same phenomenon happens in English as well.
Let A and B be two events separated by a certain amount of time. How much time is there between A and B? You might be tempted to answer
B minus A, but there are two different answers, depending on how we count time:
(a) There are 5 minutes between A = 1:05 am and B = 1:10 am. B - A = 5 minutes. This is 5分おきに - leaving 5 minutes between A and B.
(b) There are 2 days between A = Monday and B = Thursday. B - A = 3 days, not(!) two. This is 2日おきに - leaving two days between A and B.
The difference between these two cases is that in (a), time as measured in hours, minutes, seconds etc. is considered continous (uncountable) - there's 5 minutes, 5.3 minutes, 5.000321 minutes and so on. In scenario (b), time counted as weekdays or as a number of days is considered discrete (countable) - there's Monday and Tuesday, but nothing in between, we don't talk about
Monday and a half.
To illustrate this point:
1 2 3 4 5
How many numbers are there between 1 and 5? Three, namely 2, 3, and 4.
The scale of a measuring cup (for water)
0 1 2 3 4 5 (deciliter)
How many milliliters are there between 1 dl and 5 dl? The answer is 400 ml = 4 dl, not 3 dl.
ごとに have got only one basic meaning. Depending on the noun they apply to, both can refer to the same (temporal) interval.
- 2日ごとに every 2 (week) days
- 2分ごとに every 2 minutes
- 2日おきに 2 (week) days between each occurence
- 2分おきに 2 minutes between each occurence
A day consists of 24 hours. Note the difference between
48 hours between two events and
2 days between two events. And would you say that there are 2880 minutes between Monday and Thursday?
If you were looking at a clock face with each minute marked individually,
2分おきに might mean something different.
Note that this is not limited to temporal intervals.
一行おきに書く "write on every other line",
5メートルおきに杭【くい】を立てる "place stakes with a space of five meters in between".
To put it another way, you take the open interval (A,B). In the case of a continous variable, everything just a split second after 1:00 am is part of that interval, and thus you get 5 minutes between 1:00 am and 1:05 am. But in the case of a discrete variable, you get less. Consider (Monday,Thursday), Monday midnight + 1hour is not part of the interval because you're counting only in days, but not hours. There's only Monday and Tuesday, but nothing in between. So you get only two days inside the interval (Monday,Thursday), even though Thursday is 3 days after Monday.