There are a few reasons someone might do this:
Investments in a foreign currency may be incidental to the underlying investment. For example, if someone outside of the US wants to invest in APPL, they would be taking on USD risk, which could be a foreign currency to them. From that point, someone may want to hedge that risk (for example, if you have $10k USD invested in a US company, you could borrow $10k USD in debt, and then your net USD position would be Nil; obviously this creates other considerations).
Or, someone may want to directly create a hedge against some other currency risk; as Stian Yttervik mentions, you might have ongoing or future expenses in another currency (for example - planned retirement in another country), so investing in that currency now sets you up to be able to cover those future expenses, whether the currency rises or falls.
Very few people will invest long-term in currencies themselves, given that currencies are a zero-sum game. That means that if you invest in the CAD, and the Canadian economy does really well in the next 5 years, but the US economy does even better, then your CAD-USD investment could still fail - you are betting on the relative success of that currency, rather than investing in the absolute success of that currency.
Some people do put money into currency trades on a short term basis; for example right before a central bank announces interest rates, you could gamble on whether rates go up or down, and take on significant leverage that the currency moves a particular direction (and yes, gamble is usually the more appropriate word to investing in this case). Even such speculators would rarely hold long-term currency positions unless it also met one of the other objectives above. [An interesting scam-level investment 'opportunity' arose immediately after the Iraq war began, that the Iraqi Dinar was supposedly about to be pegged to the USD, and 'to support this fledgling democracy after liberation by US forces', Americans were encouraged by currency brokers to buy this currency which 'would skyrocket any day now'. Speculation like this is similar to dumping money into uncertain penny stocks hoping for a big payday.]